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

    I’m just looking into using MODx in a work enviroment, it looks perfect for what i want to do apart from one thing.

    Are the templates always held in the Database? Ideally i would like the create the templates externally then save them to a directory, which MODx would then pull in as a template. As i use version control this template would then be included, so if something broke i could easily roll back.

    At the moment the only way i see to do it is dump the database to a folder in version control, so it is then versioned.

    I am probably missing something and this is really easy to do. Any pointers on how to do this would be great.

    Thanks.
      • 27376
      • 576 Posts
      In your template put a single Snippet call.

      In the snippet code, put [tt]return include( [...] );[/tt] and include the file you want your template to be in.

        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Better to make that two lines of code, sometimes you’ll get the "return" value of the include call (1 if successful) hanging around in odd places in your page!
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 28755
          • 30 Posts
          Ahhh excellent. I knew there would be a simple answer smiley

          Thanks for the help, MODx all the way for me then grin