Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2015-02-25 14:58:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: [macro] In-article thumbnail grid?

Destry wrote #288581:

here’s the tag used in the article… <snip>

Yep, which if you thought was too much typing you could wrap up in an smd_macro called, I dunno, wion_images. Give it a single id parameter and set up the macro like this:

<txp:images
   id="{id}"
   form="thumbnail-grid"
   thumbnail="1"
   wraptag="section"
   class="thumbgrid"
   break="figure" />

or, if you’d prefer keeping things in one place instead of farming out to a Form:

<txp:images
      id="{id}"
      wraptag="section"
      class="thumbgrid"
      break="figure">
   <a href="<txp:image_url />"><img src="<txp:image_url thumbnail="1" />" /></a>
   <figcaption><txp:image_info /></figcaption>
</txp:images>

Then you can just use:

<txp:wion_images id="121,122,123,124" />

in your articles and you get all the markup rendered for free. The advantage being that if you want to ever alter the gallery markup, you only need to do it once in the macro (though you may need to re-save your articles too for the changes to take effect).

EDIT: removed unnecessary form and thumbnail attributes in 2nd example.

Last edited by Bloke (2015-02-25 15:02:09)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#14 2015-02-25 15:01:50

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: [macro] In-article thumbnail grid?

Sweet. Thanks, Stef!

And here is the new docs example for the images tag in case anyone would like to double-check its sanity.

Last edited by Destry (2015-02-25 15:55:50)

Offline

Board footer

Powered by FluxBB