We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Thanks for the too-kind words unleashed. I think you’ll find a lot of those shortcomings addressed in Revo, our total rewrite of all things MODx that take the good bits and make them better along with introducing a whole slew of great new capabilities.
      Ryan Thrash, MODX Co-Founder
      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
      • 27140
      • 7 Posts
      I had some problems when used snippet to load template. Main thing is that MODx evals snippets after it merges keywords and meta tags, so you can’t manage them as usual from management panel.
      So I found a decision in creating a plugin which is called upon "OnLoadWebDocument".
      Now my templates looks like:
      @FILE:assets/templates/mytemplate/main.tpl

      And no problems with keywords, metatags and running cached and uncached snippets.
        Regards,
        Vladimir Shugaev
      • @Shugaev

        That’s only necessary with MODx Evolution. Revo use order parsing and therefore the template will always be parsed in last position.
          • 34536
          • 4 Posts
          Do you know if this can work on Revo? (the plugin solution)
          I’ve installed just like this, but not worked... maybe needs some fix to work on 2.x ?

          anyone?
            _______________________________________________________________________
            CAS company :: www.cascompany.com
            Dedicated Servers | Cloud Servers | Cloud Hosting | Hosting | Resellers
            • 1169
            • 312 Posts
            I have no idea of plugin but have not found any problems with include snippet with Revolution

            Welcome to MODX by the way hope you achieve you goals.
              DEVELOPMENT ENV:- Ubuntu 12.04 | MODx Revolution 2.2.8 | LAMP 2i Apache 2.2.22 | Php 5.3.10 | Mysql 5.5.31 MySQL client version: 5.5.31
              • 37693
              • 47 Posts
              FYI, from Revo 2.2 onward you can easily reference external resources (templates, chunks and templates) from within the manager. They can now be edited both within the manager or externally in your text editor of choice.
                • 36533
                • 65 Posts
                shaunmorrison, can you better explain how that works? I have been searching for what you are suggesting, but I haven't been able to find any information on doing such.
                  • 32316
                  • 387 Posts
                  Say you you want a new template. This is one way to do it

                  1. Create a html template with your editor of choice, and save (as a file) to your web server - in my case this would be using BBEdit and saved to /assets/templates/mytemplate.html
                  2. In the Revo manager create a new template, give it a name and click the "Is Static" check box.
                  3. Click on the File tab, find the template you created and select and drag to the Static File box,
                  or... double click on the arrows of the Static File box and a file browser will be displayed - do what is obvious
                  or... just type the 'file_path/file_name' into the box
                  4. Save and you are done.

                  You will notice that the contents of you file will show up in the Template code box and you can edit it there or you can edit the with your editor - best of both worlds!

                  This process is identical for chunks, snippets etc., just look for the "Is Static" check box or Under settings choose Resource Type -> Static Resource though in the latter case it does show the contents of your file (at least it did not when I created a text.txt file - though I could see and edit under the Files Tab [ed. note: whistlemaker last edited this post 12 years, 3 months ago.]
                    • 5340
                    • 1,624 Posts
                    I think is better for the file to have a different extension like .tpl. Maybe you want to protect against someone guessing the template file name and finding out how you created the template, what snippets you use and possibly use this information to do harm.

                    Maybe I'm a little bit paranoid but that's how I do it smiley

                    Cheers

                    PS: your server must also be configured not to serve .tpl files
                    • You can also store them in locations outside the web root to prevent direct access.