We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15662
    • 10 Posts
    Is there a way to add php includes from another script without using snippets? I’m trying to include a php file from a seperate folder, outside of MODx, in the template and in the content area. After reading a bit, I think this has to be done in snippets, as php is ignored in other areas. But I wanted to ask and be sure before I completely rethink my plan.

    Thanks,

    Kenton
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: kenton at Feb 17, 2007, 02:19 PM

      Is there a way to add php includes from another script without using snippets? I’m trying to include a php file from a seperate folder, outside of MODx, in the template and in the content area. After reading a bit, I think this has to be done in snippets, as php is ignored in other areas. But I wanted to ask and be sure before I completely rethink my plan.

      Thanks,

      Kenton

      You are correct, PHP code is limited to snippets, though you can also use Template Variables (TV’s) with the @EVAL binding to execute PHP code.
        • 33372
        • 1,611 Posts
        Of course your snippet can just consist of
        include 'your-script.php';

        if all you want to do is include an external file...
          "Things are not what they appear to be; nor are they otherwise." - Buddha

          "Well, gee, Buddha - that wasn't very helpful..." - ZAP

          Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options