Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#325 2009-01-07 10:13:21

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

Re: smd_gallery: super-flexible gallery generator

rvturnage wrote:

{onchange:category} {grouptagstart} <a href="#"><img src="{url}" alt="{alt}" /></a> <div>{title}</div> {grouptagend}

Hi, this is one of the unfortunate side-effects of not having image encapsulation in TXP. I answered something similar a few weeks ago and that may help you work out a solution in the meantime, though it requires another plugin.

The bottom line is that every image is passed through the form and only the {object} tag understands thumblimit. I’d love to make the form/thumblimit and {object} a bit more intelligent but it either takes a tonne of extra code or a change to the way images are handled in TXP.

Having said that, I may try and revamp it a bit, because having to rely on the {object} tag as a fixed output is a pain. Perhaps an objectform might be possible, I’ll look into it and see what I can come up with.

Second, is there some way to have the category attribute pulled from the URL so galleries could be loaded dynamically based on the URL?

Today the answer is no, sorry. Tomorrow (or in a few days time at least) the answer will be yes because v0.5 unlocks this feature since it uses smd_lib which has this ability built in. So under v0.5 you’ll be able to do:

<txp:smd_gallery category="?title" />

In your case you’d need to do something a little differently because you intend not to actually create any corresponding article. In that case you have two avenues open to you:

  1. fashion your URLs like this: site.com/gallery_view/?gall=2008-gallery and use <txp:smd_gallery category="?gall" /> to read in the URL variable (perhaps gbp_permanent_links can help hide the messy URLs?)
  2. use an error_404 page template that does this somewhere inside it:
<txp:if_section name="gallery_view">
  <txp:smd_gallery category="?REQUEST_URI" form="gallery_overview" />
</txp:if_section>

(untested – might not work like that)

The idea of the last approach is that any broken link in that section will actually render a gallery. You might also want to surround the gallery tag with some conditional (e.g. the chh_if_data plugin or some clever use of the URL parts to extract the ‘title’ and put it in a <txp:variable /> that you can check), thus you can take action and show “Sorry, no gallery” for the times where there’s actually no image category of that name.

Not quite the answers you hoped, but possible avenues for exploration. I’ll try and package up v0.5 as soon as I can and release it.


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

#326 2009-01-07 11:06:15

lozmatic
Member
From: Melbourne, Australia
Registered: 2006-08-27
Posts: 259
Website

Re: smd_gallery: super-flexible gallery generator

Hi, thumblimit="1" isn’t working for me. All images are displayed instead.

I’ve got this:

<txp:smd_gallery id='17,18' thumb="0:1" form="list.photo.apartment.form" thumblimit="1" />

and the form is the one in the example:

<a rel="lightbox-smd" href="{url}" title="{title}">{object}</a>

Any ideas?

Offline

#327 2009-01-07 11:21:12

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

Re: smd_gallery: super-flexible gallery generator

lozmatic wrote:

thumblimit="1" isn’t working for me. All images are displayed instead.

Add onchange="" to your gallery tag; by default it’s set to category. Since you’re using id instead of category, the plugin sees the 2nd image is in a new category and dutifully thinks it needs to start counting thumbs again from 1 (it resets the counter at each onchange item so you can make headed sub-galleries with one smd_gallery tag — in this case you don’t want it to do that).


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

#328 2009-01-07 14:27:16

rvturnage
New Member
Registered: 2009-01-06
Posts: 5

Re: smd_gallery: super-flexible gallery generator

Bloke wrote:

Hi, this is one of the unfortunate side-effects of not having image encapsulation in TXP. I answered something similar a few weeks ago and that may help you work out a solution in the meantime, though it requires another plugin.

Thanks, Bloke. Sorry I missed that post. I tried reading through all 33 pages prior to posting. Guess I missed a few :) I’ll go over that previous post and see if I can get it working.

Today the answer is no, sorry. Tomorrow (or in a few days time at least) the answer will be yes because v0.5 unlocks this feature since it uses smd_lib which has this ability built in. So under v0.5 you’ll be able to do:

<txp:smd_gallery category="?title" />

Not quite the answers you hoped, but possible avenues for exploration. I’ll try and package up v0.5 as soon as I can and release it.

These both look like good avenues to explore..thanks for the help. I’ll look into that gbp_permanent_links plugin too. I look forward to trying out that upgrade when you get it! Thanks again for your help, and for the great plugin.

rvt

Offline

#329 2009-01-07 14:44:55

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

Re: smd_gallery: super-flexible gallery generator

rvturnage wrote:

Sorry I missed that post. I tried reading through all 33 pages prior to posting.

No problem. Do what I do and set your forum profile to view 20 posts per page, then it only looks half as bad :-D

Hope you find a (hopefully temporary) solution until I can address these things in the plugin itself.


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

#330 2009-01-09 14:02:03

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Hellooooo,

I’ve this:

<txp:smd_gallery id="?article_image" combo="type:captioned-image,align:right" form="inline_image" />

calling this:

<txp:variable name="type" value="{type}" />
<div class="image {type} {align}" style="width:{width}px">
  <txp:upm_image image_id="{id}">
  <img src="{url}" width="{width}" height="{height}" alt="<txp:upm_img_alt />" title="<txp:upm_img_caption />"/>
  <txp:if_variable name="type" value="captioned-image">
  <small><txp:upm_img_caption /></small>
  </txp:if_variable>
  </txp:upm_image>
</div>

It works like a charm… but I was thinking how to let the end-user have more control about alignment and show/hide caption… without using custom fields…

So, I came up with this idea (ejem… feature request): abuse the article_image field :D.
Something like this (on the article_image input field):

68, captioned, right
or
15, image, left
or even crazier:
19, captioned, left, 15, captioned, right, 28, image, center

And so on…
Of course, this will require some clever way to “configure” how (in which order) smd_gallery will pick up the values…

Bloke, the ball is in your field ;)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#331 2009-01-09 23:03:59

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,702
Website

Re: smd_gallery: super-flexible gallery generator

Just gotta say, the more I use this plugin the more I love it! … And, of course, I have a query too:

Is there an easy way to trigger an onchange and new group based on a certain number of iterations, e.g. use one smd_gallery tag which onchanges after every nth picture break and use the group tags?

Explanation: I found myself in a similar situation to Dale’s back here with three parallel fade-in-out slideshows that should display randomly. The same picture should not appear twice so it’s not possible to call smd_gallery three times over each using random. At the time you offered a complicated php-based solution.

For the moment, I have found a solution using your other swiss-army-knife-of-a-plugin smd_if:

<!-- three flic-flac innerfade slideshows -->
      <ul class="slideshow">
<txp:smd_gallery category="frontpage" limit="9" sort="random">
<txp:smd_if field="{counter}" operator="in" value="4/7">
      </ul>
      <ul class="slideshow">
</txp:smd_if> 
       <li><a href="<txp:permlink id="{alt}" />"><img src="{url}" alt="" /><span>{title}</span></a></li>
</txp:smd_gallery>
      </ul>

smd_gallery generates a nice random assortment of 9 images from the ‘frontpage’ category and smd_if tests if the incremental counter is 4 or 7 and inserts a group-end and group-start tag if that is the case. By changing the limit attribute in smd_gallery and the value increments in smd_if one can control this nicely.

At first I tried using operator="divisible:NUM" value="3" with smd_if but it cuts in one too early. The insertion needs to occur after the counter that is divisible by three e.g. when counter = (divisible by 3) + 1.

Note: I’ve abused the alt tag to contain the Article-ID of the relevant article so that I can link to it.

One single call to jquery.innerfade is all that is needed to set off all three linked slideshows.

After doing all that, I wondered if you had already come up with an “onchange interval” solution?

[ Apologies if this was already dealt with in the past 17 pages and I missed it ].


TXP Builders – finely-crafted code, design and txp

Offline

#332 2009-01-10 00:48:23

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

Re: smd_gallery: super-flexible gallery generator

Hi jakob, an excellent soution you came up with there. Ingenious use of the tags. Shame that — as you say — smd_if can’t render the +1 case, that would have made it an even more appealing approach.

However…

jakob wrote:

Is there an easy way to trigger an onchange and new group based on a certain number of iterations

You just never know when your wishes might come true:

<txp:smd_gallery category="frontpage" limit="9" sort="random" onchange="smd_every:3" grouptag="ul" groupclass="slideshow">
{grouptagstart}
   <li><a href="<txp:permlink id="{alt}" />"><img src="{thumburl}" alt="" /><span>{title}</span></a></li>
{grouptagend}
</txp:smd_gallery>

(well alright, that syntax is in v0.5 and generates the same as your code in the post above. Wanna try it out… get in touch)

EDIT: maniqui, I’ll get back to you on your proposal when I get a chance to digest it.

Last edited by Bloke (2009-01-10 00:58:55)


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

#333 2009-01-10 08:54:07

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,702
Website

Re: smd_gallery: super-flexible gallery generator

onchange=“smd_every:3”

You never cease to amaze me: Excellent – that would be perfect!
I guess one could use grouptagend on its own too when one wants to add a manual break or clearing element? Would that simply be a matter of not specifying grouptagstart or giving it “” as a tag?


TXP Builders – finely-crafted code, design and txp

Offline

#334 2009-01-10 10:49:10

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

Re: smd_gallery: super-flexible gallery generator

jakob wrote:

I guess one could use grouptagend on its own too when one wants to add a manual break or clearing element?

Yep, in theory. grouptagstart is blank by default so just setting a grouptagend would add a break every nth element (haven’t tried it, but it should).


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

#335 2009-01-14 16:14:05

Kreeltje
Member
Registered: 2008-12-23
Posts: 21

Re: smd_gallery: super-flexible gallery generator

Is it possible to make a categorylist with 1 thumbnail and title,
and if you click on of those, you get all thumbnails from that category?

Offline

#336 2009-01-14 16:28:25

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,064
Website GitHub Mastodon Twitter

Re: smd_gallery: super-flexible gallery generator

hi kreeltje

Yes it is. You can use txp’s article_image and you can call the rest of the category thumbnails within that article.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB