We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53124
    • 2 Posts
    Hi everyone !
    I am building a website using Foundation Framework, one of the many functions it has is the 'interchange images'.
    The problem is that to include a TV or a Chunk inside this Foundation function using [[ ]] is not working, for Foundation also uses [ ].
    I am trying
    <div data-interchange="[[[*TVname]], small], [[[*TVname]], medium]"></div>

    Is there a way to make this work?

    For your help, many thanks !
      • 30585
      • 833 Posts
      Assuming you're getting the TV value of the current document, you could write a small snippet (geTVValue) to handle this:
      // get the TV name
      $tv     = $modx->getOption('tv', $scriptProperties, '');
      // get the TV value of the current resource
      $value  = $modx->resource->getTVValue($tv);
      $output = '<div data-interchange="[' . $value . ', small], [' . $value . ', medium]"></div>';
      return $output;
      


      Then on your page, call it like this:
      [[geTVValue? &tv=`TVname`]]


      You could put your HTML in a chunk for a cleaner code.
        A MODx Fanatic
        • 20413
        • 2,877 Posts
        Excellent snippet and solution above.

        An idea is to see if escaping the brackets would work:
        <div data-interchange="\[[[*TVname]], small\], \[[[*TVname]], medium\]"></div>

        [ed. note: mrhaw last edited this post 9 years, 8 months ago.]
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 3749
          • 24,544 Posts
          I think this would work and would be a lot simpler (assuming that whatever is processing the data-interchange parameter doesn't care about white-space -- and I bet it doesn't):

          <div data-interchange="[ [[*TVname]], small], [ [[*TVname]], medium]"></div>
            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
            • 40706
            • 128 Posts
            I also used htmlentities for Problems like this with [ &#91; and ] &#93;

            or create an output filter which returns the value wrapped by brackets