We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45459
    • 5 Posts
    Hi there,
    I'm new in modx so have lots of questions. I have filterable jQuery plugin which requires space-separated class names in <li>-tag. The final html-code should be as below:
    <li class="mix Tag1 Tag2 data-cat="1" ">
    <а hrеf="link to iamge" rel="colorbox" title="">
    <img class="" src="source to thumbnail" alt="" />
    </a>
    <р>Tag1 Tag2</р> 
    </li>


    My snippet call and chunk:
    [[!Gallery? &album=`AlbumName` &toPlaceholder=`Gallery1` &useCss=`0` &thumbWidth=`140` &thumbHeight=`100` &thumbTpl=`GalItemThumb` &imageWidth=`800` &imageHeight=`800`]]


    GalItemThumb chunk:
    <li class="mix [[+tags]] data-cat="1"">
        <a href="[[+image]]" rel="colorbox" title="[[+description]]">
            <img class="[[+imgCls]]" src="[[+thumbnail]]" alt="[[+name]]" />
        </a>
    [[+tags]]  
    </li>


    But this returns comma-separated tags: Tag1,Tag2. Is there a way how manage this? I spent all my day to find solution but without success. Thanks! [ed. note: bloodninza last edited this post 12 years, 11 months ago.]
      • 42046
      • 436 Posts
        • 45459
        • 5 Posts
        Quote from: absent42 at Oct 20, 2013, 12:05 PM
        Use &tagSeparator in your call.

        http://rtfm.modx.com/extras/revo/gallery/gallery.galleryitem

        Hi Dan, thanks, but I have another problem:
        Now tags without comma, but they are placed to html template with couple additional tags. Now I have in the frontend:
        <li class="mix
         <span class="gal-item-tag"><a href="Link-to-tag">Tag 1</a></span> 
         <span class="gal-item-tag"><a href="Link-to-tag">Tag 2</a></span>
         data-cat="1"
        ">
            <a href="link-to-image" rel="colorbox" title="">
                <img class="" src="link-to-thumb" alt="paris" />
            </a>
        <span class="gal-item-tag"><a href="Link-to-tag">Tag 1</a></span> 
         <span class="gal-item-tag"><a href="Link-to-tag">Tag 2</a></span>  
        </li>


        How I can remove unnesessary <span> and <a>? I need only tag name without any html tags.

        What I tried:
        I've put GalleryItem snippet call to GalItemThumb chunk:
        <li class="mix [[!GalleryItem? &id=`[[*id]]` &toPlaceholders=`1` &tagTpl=`GalleryItemTagTpl` &tagSeparator=` `]][[+galitem.tags]] data-cat="1"">
            <a href="[[+image]]" rel="colorbox" title="[[+description]]">
                <img class="[[+imgCls]]" src="[[+thumbnail]]" alt="[[+name]]" />
            </a>
        [[+galitem.tags]]  
        </li>
        


        and created new chunk (GalleryItemTagTpl) for GalleryItem snippet trying to overwrite default tag output (unfortunately doesn't work):
        [[+galitem.tag]]


        Where I made mistake?
          • 42046
          • 436 Posts
          No need to overwrite, specify your tag template with &tagTpl

          http://rtfm.modx.com/extras/revo/gallery/gallery.galleryitem
            • 45459
            • 5 Posts
            Quote from: absent42 at Oct 20, 2013, 02:45 PM
            No need to overwrite, specify your tag template with &tagTpl

            http://rtfm.modx.com/extras/revo/gallery/gallery.galleryitem
            I used &tagTpl=`GalleryItemTagTpl` to customize tags output (see above). The problem was in id param. To have everything working good it's needed to replace *id to +id here:
            <li class="mix [[!GalleryItem? &id=`[[+id]]`


            That's all!
              • 42046
              • 436 Posts
              * always refers to the current resource, + to a child resource.