We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19438
    • 13 Posts
    Mike Stop Continues Reply #1, 16 years, 1 month ago
    My site requires a number of templates, each of which share some TVs, but not others. Knowing that I would need getResources to for the rolling pages and in an effort to maintain a friendly ecology, I did this:

    template: Definition
    --chunk: typeDefinition
    ----chunk: nodeThumbnail
    ----chunk: nodeTags

    template: Model
    --chunk: typeModel
    ----chunk: nodeThumbnail
    ----chunk: nodeTags

    template: Pattern
    --chunk: typePattern
    ----chunk: nodeThumbnail
    ----chunk: nodeTags

    etc.

    The goal is to call typeWhatever in my template and in a getResources page. The obvious problem is that getResources requires [[+reference]] syntax, not [[*tv]] syntax. I’ve come up with the following solutions to allow the sharing of chunks, but I want an even better solution.


    • Use this [[+id:empty=`[[*id]]`]] syntax to ensure the chunks work with both.
    • Or, use a giant property set on every chunk in the solo templates that defaults every [[+this]] to [[*this]]. Again, not very pretty.
    • Combine these two options, so that the default properties for each chunk connect [[+id]] to [[+id:empty=`[[*id]]`]]. Cleaner templates, but it’s just hiding all the crazy.
    • Use [[+this]] syntax universally, and in my templates, use getResources to call even single pages. This has the best organization of logical levels, but it obviously brings up concerns about speed/efficiency.

    So... What can I do better?

    Thanks.
      • 19438
      • 13 Posts
      Mike Stop Continues Reply #2, 16 years, 1 month ago
      Quote from: Mike at Aug 31, 2010, 10:39 AM


      • Use this [[+id:empty=`[[*id]]`]] syntax to ensure the chunks work with both.

      Interestingly (and sadly), though this method works in the getResources &tpl, it doesn’t work in any sub-chunks, and will draw the information from the first of the resources for some reason.