We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8439
    • 89 Posts
    Having installed my candidate modx site. I want it as clean as possible so I omit to sample site and end up with a site with a single page.

    Step 1 is to create a template for the home page and then create a document from that template and then to make that the site start page.

    First problem, I can’t import the html files, I’m expected to copy and paste their contents, you can’t be serious! it should be possible for all editing/creation tools to include an external file at the current position within the edit buffer. In the real world, people will use external templates, version control etc and MODx should be able to easily integrate externally managed files within a site. Equally it should be possible to replace some or all of an existing template by the contents of an external file. I regard this as a serious shortcoming.

    A question, when creating a document, it gets doc id 2 and I have to edit the site system configuration to change the doc ids for the start, error pages etc to 2. I have deleted the document with id 1 but it is displayed crossed through, how do I make it go away? Having done that how do I get my home page to have doc id 1? Is replacing the default doc by the contents of my own the only way?

    Ed
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      So make a snippet,
      include /path/to/myfile/myfile.php;
      return;
      

      and use the snippet in the template form textarea.

      Why delete the default document? Just edit it.

      To undelete a document, right-click and undelete. To remove deleted documents, click the little trash can icon at the top of the document tree.
        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
        • 8439
        • 89 Posts
        Quote from: sottwell at Aug 26, 2006, 07:35 AM

        So make a snippet,
        include /path/to/myfile/myfile.php;
        return;
        

        and use the snippet in the template form textarea.

        Why delete the default document? Just edit it.

        To undelete a document, right-click and undelete. To remove deleted documents, click the little trash can icon at the top of the document tree.

        Isn’t it easy when you ask someone who knows? I had suspected that changing the default document was the way forward. I really think these tricks need to be up front in the install/content editing documentation. This is no criticism just the observation that people are more likely to notice what isn’t documented than what is smiley

        The include trick looks neat, my html template has user-edited variant text in it, so what I need to do in the file to be included is place [*content*] in the appropriate place. Then have the include snippet as the template body, and use the editor to fill in the content for each document? This certainly meshes well with version control systems

        However, it is still IMHO generally desirable (essential?) to include external files inline.

        Ed
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Think of snippets as wrappers for inline PHP code.

          Of course, in the file you are including, you can have all the inline stuff you like.
            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