We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14162
    • 67 Posts
    Rather than creating static resources and editing the files in an IDE (which is one solution), I figured that using static elements (in this case chunks) might be better:

    1. Create a simple snippet (in this example, called 'parseChunk'):
    if ($name) { return $modx->parseChunk($name,'');} return;
    [Note: the second parseChunk argument is required to avoid an error. This could be used for additional variables]

    2. Create a standard template (called, say, 'Main') and instead of having [[*content]] put:
    [[!parseChunk? &name=`page_[[*alias]]`]]

    3. Create a Document resource for each of your pages using the Main template. Don't put anything in the content field.
    4. Create static chunks for each of your pages, named 'page_index' - where 'index' is the alias of the associated resource.

    Now you can edit the static chunks in your favourite IDE and it will automatically update the associated web page. Of course you still have to create resources for every page, but you wont need to edit them. [ed. note: jimbob72 last edited this post 8 years, 8 months ago.]
    • And since static elements do work with media sources, you could have your content stored anywhere there is a media source driver for.
        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