We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8109
    • 128 Posts
    I use a lot of template variables for my resources. If the page is viewed directly, the placeholder syntax for TVs is [[+tvName]]. But if I need the same resource to be called into a listing with GetResources, those same placeholders need to be [[*tvName]] to work correctly. Do I need to create two copies of every such resource, or is there a handy workaround?
      Revo 2.0.8-pl
      • 35150 ☆ A M B ☆
      • 191 Posts
      (I think you have + and * reversed in your post..)

      This is a neat thing to do if you can make it work, have a chunk which can be called directly from a template, and as a getResources or MIGX template.
      First, you want to use only placeholders in your chunk. If you're calling it directly from a template which has those TVs, do it like this:
      [[$someChunk? &tvName=`[[*tvName]]`]] (in your chunk you'll always reference tvName as [[+tvName]])

      If you want to get fancier, you might look at my extra, called setPlaceholders ( http://modx.com/extras/package/setplaceholders ). It lets you do all sorts of fun stuff like that.
      For instance, you can store a TV in a placeholder for your whole template, and any chunks and snippets called from it.
      Near the top of the template you'd have something like: [[setPlaceholders? &ph=`tvName == tv.tvName`]]
        Extras :: pThumb • Resizer • imageSlim • setPlaceholders
        • 3749
        • 24,544 Posts
        Quote from: drwagner13 at Feb 27, 2013, 02:00 AM
        I use a lot of template variables for my resources. If the page is viewed directly, the placeholder syntax for TVs is [[+tvName]]. But if I need the same resource to be called into a listing with GetResources, those same placeholders need to be [[*tvName]] to work correctly.

        This is backwards, BTW. It's the other way around. wink

          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting