We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3544
    • 9 Posts
    I would like to bulid a site with template within teplates.
    Eg. A main template for the universal design and navigation, and a second template within this template with the design of output from resource.
    The templates should be called when a resource/page is called and if the page is connected to the second template, the second template calls the main teplate.

    If templates was able to have a relation to a template such as a resurce/page has then this would be possible, but how do I accomplish this with Revolution?
      • 22019
      • 390 Posts
      I’m a relative novice, but I think what you’re after is a conditional chunk inside the template, that outputs one chunk if the resource meets certain conditions, and another chunk (or chunks) if it’s another. Resources have no concept of ’page type’ (this is usually dictated by the template), but I guess you could create a template variable of page type, which you could use as the parameter to output the conditional bit.

      There are probably other ways to achieve the same goal. But tbh, if you’re distinguishing by page type, templates are usually so small that I’d simply create a new one for each type:

      At their most minimal:
      [[$pageHeader]]
      [[$articlePageTpl]]
      [[$pageFooter]]
      ...
      [[$pageHeader]]
      [[$blogPostTpl]]
      [[$pageFooter]]

      You’re already re-using most of the ’template’ because the pageHeader and pageFooter chunks stay the same.
        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Most content generators (like getResources) use their own mini-tpls to format their output.
          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
          • 3544
          • 9 Posts
          Thanks for the input.
          I have been thinking of using some kind of conditional switch to differetiate the output, but since there is a default option to select a template to be used when creating the resource I would like to be able to use this for defining the formating.
          I think it’s kind of clutering and feel that I’m loosing overview when separating the stuff that my "conceptual preception" thinks belong in a template by placing the pieces of formating of one single layout/template/page in a bunch of separate chunks.

          Making templates able to "use template" may be featurerequest for a wishlist of a future version of Revo. Or am I the only one that feels this is missing.
            • 2861
            • 8 Posts
            Hi,

            I solved this with template variables.
            - I made some template variables, in Default Value I type the HTML that I want to insert (ie: contactUs)
            - Connect the Template variable to your template (Template Access)
            - In the template I insert the Template variable on the spot it should be (ie: [[*contactUs]])

            Now when you create a page (resource) with this template you go to the tab "Template variables" and erase the HTML from the Template variables you don’t want to show on your page.

            Hope this helps.