Textpattern Forum

You are not logged in. Register | Login | Help

#131 2008-06-10 18:56:19

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

Re: smd_gallery: super-flexible gallery generator

jstubbs wrote:

0.43 is now working, at least the compressed version. The non-compressed version gave me a badly formed plugin error.

I expected that. It’s teetering on the edge of 100kb of BASE64 which is approaching the theoretical maximum I think for plugins (no idea the actual value). I’ll have to learn to be more terse in my plugin help ‘cos 65% of that is help text!

How should the new attributes – grouptagstart/grouptagend be used to accomplish what I need?

Look at example 6 in the help for more detail but, in a nutshell, use the new tags in your gallery form like this:

<txp:if_different>
<h2>{category_title}</h2>
</txp:if_different>
{grouptagstart}
<a href="{url}" title="{title}"><img src="{thumburl}" alt="{alt}" /></a>
{grouptagend}

(or use {object} instead of the img). That’ll put <div class="box">...<div> around each block of images every time the category changes. It works without extra options because onchange is set to watch for category changes by default. Every time the category changes to the next one, the grouptags are loaded with the div/class you specified.

Hopefully the sort=“fixed” will maintain your category order too. Fingers crossed, it worked on my setup…

EDIT: and if you want to wrap the entire thing — <h2> and all — just move the {grouptagstart} to the top of the form.

Last edited by Bloke (2008-06-10 18:59:20)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#132 2008-06-10 19:08:58

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,178
Website

Re: smd_gallery: super-flexible gallery generator

Mmm. I now have this:

<txp:smd_gallery category="STA-Training, STA-Facilities, STA-Players, STA-Staff, STA-On-Tour" wraptag="div" class="thumbs" form="gallery" sort="fixed" grouptag="div" groupclass="contentbox" />

And this for the form:

<txp:if_different>
<h2>{category_title}</h2>
</txp:if_different>
{grouptagstart}
<a href="{url}" title="{title}">{object}</a>
{grouptagend}

Not quite working yet – you can see the result


TXP Tips | @txptips | Me | @jonathanstubbs | Github

TXP Builders – finely-crafted code, design and txp @txpbuilders

Offline

#133 2008-06-10 19:20:01

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

Re: smd_gallery: super-flexible gallery generator

Hmmm, I think that’s a byproduct of the if_different tag. I think it’s being processed first before the plugin tags. You might be better off adding onchange="category_title" to the smd_gallery tag and using:

<h2>{onchange:category_title}</h2>
{grouptagstart}
<a href="{url}" title="{title}">{object}</a>
{grouptagend}

Last edited by Bloke (2008-06-10 19:20:18)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#134 2008-06-10 19:23:36

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

Re: smd_gallery: super-flexible gallery generator

Nuts, I meant:

{onchange:category_title}
{grouptagstart}
<a href="{url}" title="{title}">{object}</a>
{grouptagend}

and use onchangewraptag="h2" as well

Last edited by Bloke (2008-06-10 19:24:51)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#135 2008-06-10 19:29:38

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,178
Website

Re: smd_gallery: super-flexible gallery generator

Stef, what you post above did not quite work, so I now have this:

<txp:smd_gallery category="STA-Training, STA-Facilities, STA-Players, STA-Staff, STA-On-Tour" wraptag="div" class="thumbs" form="gallery" sort="fixed" grouptag="div" groupclass="contentbox" onchange="category_title" />

And form:

{grouptagstart}
<txp:if_different>
<h2>{category_title}</h2>
</txp:if_different>
<a href="{url}" title="{title}">{object}</a>
{grouptagend}

Please check the result in the page….looks ok to me!

Edit: I mean the previous example did not work – not tried your latest example.

Last edited by jstubbs (2008-06-10 19:31:17)


TXP Tips | @txptips | Me | @jonathanstubbs | Github

TXP Builders – finely-crafted code, design and txp @txpbuilders

Offline

#136 2008-06-10 19:33:11

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,178
Website

Re: smd_gallery: super-flexible gallery generator

This is what I now have:

{onchange:category_title}
{grouptagstart}
<a href="{url}" title="{title}">{object}</a>
{grouptagend}
<txp:smd_gallery category="STA-Training, STA-Facilities, STA-Players, STA-Staff, STA-On-Tour" wraptag="div" class="thumbs" form="gallery" sort="fixed" grouptag="div" groupclass="contentbox" onchange="category_title" onchangewraptag="h2" />

The results are on the STA website

Last edited by jstubbs (2008-06-10 19:33:36)


TXP Tips | @txptips | Me | @jonathanstubbs | Github

TXP Builders – finely-crafted code, design and txp @txpbuilders

Offline

#137 2008-06-10 19:34:38

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

Re: smd_gallery: super-flexible gallery generator

jstubbs wrote:

Please check the result in the page….looks ok to me!

Yay!

But I have just spotted that it’s not in fact if_different, it’s my backwards logic at detecting when something has “changed”. Unfortunately it means — as you found — that if you put the {grouptagstart} under the {onchange}, it gets included in the next block instead of being on its own.

I think I know why it’s doing it but I gotta employ some brain power to figure a way round it. And I’ve just had some wine so my mind’s not on top form ;-)

If you can live with it for the time being I’ll see if I can patch it, sorry about the false start.

Last edited by Bloke (2008-06-10 19:35:17)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#138 2008-06-10 19:41:57

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,178
Website

Re: smd_gallery: super-flexible gallery generator

Yeah I had two beers tonight so I have the same problem with my head :-)

Note I am now using the code from my previous post – #136. It would be good to figure a way to put the H2 outside of the contentbox div instead of inside it. I’ll think about that – when the beer wears off :-)


TXP Tips | @txptips | Me | @jonathanstubbs | Github

TXP Builders – finely-crafted code, design and txp @txpbuilders

Offline

#139 2008-06-10 19:46:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

Re: smd_gallery: super-flexible gallery generator

jstubbs wrote:

It would be good to figure a way to put the H2 outside of the contentbox div instead of inside it.

Yeah, I’m on the case. It’s an unfortunate side-effect of me trying to cut corners and do things the easy way instead of doing it properly :-/

The end and start tags are sandwiched together at all places except the first and last gallery so there ain’t nothin’ gettin’ between ‘em no matter how hard you try!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#140 2008-06-10 22:18:56

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

Re: smd_gallery: super-flexible gallery generator

Once more with feeling.

v0.44 | compressed should now work as advertised in the grouptag department.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB