We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24993
    • 19 Posts
    Dear all,

    To save building a contact form (I’m no php coder) I repeated my Dreamweaver site code inside MODx Revo 2 but it will not work. Blank area where form should be.

    I have a contact page resource containing form snippet:

    <div align="center">
    [[contactForm]]
    </div>

    The ’contactForm’ snippet code for my encoded php form file is:

    <?php
    $file=’assets/templates/form.php’;
    include($filename);

    I have the <base href="[[++site_url]]" /> set in my base template.

    How to I modify my snippet for call to find my file? Sorry for the newbie stuff here. Been searching posts and reading lots of Evo snippet stuff but nothing obvious enough for me to solve.


      Richard
      Hong Kong
      • 28215
      • 4,149 Posts
      splittingred Reply #2, 16 years ago

      <?php
      $file= $modx->getOption('assets_path',null,MODX_ASSETS_PATH).'templates/form.php';
      $o = '';
      if (file_exists($file)) {
        $o = include $file;
      } else {
         $o = 'File not found: '.$file;
      }
      return $o;
      

        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 24993
        • 19 Posts
        Wow Shaun,

        Thanks for your near instant reply. Very much appreciated.

        The code is now finding the file Ok but something odd with file itself now, although it works fine with old html/php site. Below is what I am getting. Is this due to snippet in the db?

        Any advice on this, or should I go back to form designer service I have where the compiled code is made? (formdevil.com)

        Best regards,
        Richard

        Parse error: syntax error, unexpected $end in C:\xampp\htdocs\richardentwistle.com\assets\templates\form.php(5) : eval()’d code on line 2373
          Richard
          Hong Kong
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: RichardHK at Oct 01, 2010, 08:39 AM

          Parse error: syntax error, unexpected $end in C:\xampp\htdocs\richardentwistle.com\assets\templates\form.php(5) : eval()’d code on line 2373
          That just means you have a syntax error in your PHP file.