This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Mobile view not functioning properly when using PHP embed code.


  1. Steve1951
    Member

    The mobile view is not functioning properly when using PHP embed code. It functions properly when using the link only. If the screen width is less than 800px the mobile version should be displayed.

    Here is a sample using the link only - http://www.schuckman-test.com/machform/view.php?id=5891 - This functions OK.

    Here is a sample of the same form using PHP embed code - http://www.schuckman-test.com/test_of_php_emebd_code_mobile.php - This does not function properly.

    Here is the PHP code I am using.

    <?php session_start(); ?>
    <!DOCTYPE html>
    <html>
      <head>
        <title>Test of mobile forms using PHP Embed Code.</title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
      </head>
      <body>
    
    <?php
    require("/home3/removed/public_html/schuckman-test/machform/machform.php");
    $mf_param['form_id'] = 5891;
    $mf_param['base_path'] = 'http://www.schuckman-test.com/machform/';
    display_machform($mf_param);
    ?>
    
      </body>
    </html>
    Posted 11 years ago #
  2. yuniar

    Thank you for reporting this. This seems to be a bug which affect the PHP embed code.
    The fix is quite simple though. You can edit your "includes/view-functions.php" file. Search around line 4972 for this code"

    {$view_css_markup}

    right below that line, insert this code:

    <link rel="stylesheet" type="text/css" href="{$machform_path}view.mobile.css" media="all" />

    that should fix it.


    MachForm Founder

    Posted 11 years ago #
  3. Steve1951
    Member

    Thanks - That fixed it. Support for this product is fantastic as usual.

    Posted 11 years ago #
  4. anujagrawal
    Member

    I am having the same issue as the original poster (i.e. using php embed code does not display nicely on mobile device), and the fix suggested already exists in the version of MachForm I have.

    When viewing on a smart phone (Galaxy S4) or tablet (iPad 2), the page loads, but all the styles are not in effect. :(

    When i try loading the same form via view.php, the styles are applied and the form looks awesome! I would like the embedded form to load the same way.

    Anything else I could look at?

    Posted 9 years ago #
  5. yuniar

    When being embedded using the php embed code, the mobile view will completely depends on your main page layout/responsiveness.
    If your main page is not responsive, then the form won't be responsive as well.


    MachForm Founder

    Posted 9 years ago #
  6. anujagrawal
    Member

    The only code i have in my "main page" is the embedded php code.

    Posted 9 years ago #
  7. anujagrawal
    Member

    So the only code i have in my php file is:

    <?php 
    
    require("C:/Users/developer/machform/machform.php");
    
    $mf_param['form_id'] = 13634;
    $mf_param['base_path'] = 'http://localhost/machform/';
    $mf_param['show_border'] = true;
    display_machform($mf_param);
    
    ?>

    On a desktop, as i shrink the browser window, it switches to mobile view. But that does not happen on my smart phone. Any thoughts as to why?

    Thanks.

    Posted 9 years ago #
  8. yuniar

    Is that the exact form code being used to embed your form? If so, that won't work indeed, as the URL is pointing to "localhost". You need to change the URL with a valid IP address or domain to be accessible correctly from other devices.


    MachForm Founder

    Posted 9 years ago #
  9. anujagrawal
    Member

    Ah! Thanks so much! That works!

    Posted 9 years ago #

RSS feed for this topic

Reply