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

    I recently installed Evolution 1.0.2.

    I have a website that is ready to be launched. I decided to try integrating the website into MODx. The website includes XHTML, CSS, JavaScript, and PHP. Once launched, I am implementing a second phase of the project: providing the client with content management functionality; hence my desire to use MODx.

    I have spent a few hours learning how to create templates and resources, and the static portion of the website is done.

    I am now in the process of integrating the PHP code, specifically for a contact form. This is where my first general question arises - is it necessary to re-do all of the PHP code as snippets, or is there a way to re-use the PHP from the website as-is? I believe this is complicated by the fact I use session variables to remember values entered by the user, so a reload of the contact form doesn’t wipe out their data. In other words, the best way to access session variables is to ensure all PHP code is run in snippets, correct?

    If everything should be converted to snippets, how should the validation code (the code run when the form data is posted) be re-worked? Is the format suggested by Breezer in this thread http://modxcms.com/forums/index.php?topic=27000.0 the way to go?

    I seem to be at a point of no return: either keep spending time re-writing the website for MODx, or abandon this approach and write my own content management for the client. It is involving more of a re-write to integrate this website than I first thought it would be, and am wondering if I am doing something wrong.

    Thanks,
    Ben
      • 4310
      • 2,310 Posts
      Converting custom PHP forms isn’t usually too bad.
      You should probably only need one snippet.
      The PHP goes in the snippet, you can put the HTML into a chunk, or as Breezer showed mix the two in the snippet if that’s easier.
      I’d think it would be a lot less work than
      write my own content management for the client
        • 3749
        • 24,544 Posts
        If you just need a simple contact form, you might look at the SPForm snippet. Otherwise, yes, the php code has to go in a snippet or snippets.

        The eForm snippet is another alternative if you need a more complicated contact form.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting