Textpattern CMS support forum

You are not logged in. Register | Login | Help

#931 2013-11-12 21:42:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,611
Website

Re: smd_gallery: super-flexible gallery generator

robew wrote:

I’m trying to display a limited list of thumbnails with next and prev navigation.

Congratulations: I think you’ve found a limit to this plugin’s capabilities ;-)

I never considered the situation you might wish to independently paginate both thumbs and full size images. Can’t think of a neat way to handle it. It gets messy whichever way you try to bend the plugin with count forms or paging.

I’d be tempted to use no limits and employ a Javascript pagination plugin to hide the thumbnails in steps of 5 images. That way, you have control over how the thumbs behave / slide / fade. There may even be a Javascript gallery plugin you can use which will add the pagination from the full set of images / thumbs on the page. In which case, you probably won’t need smd_gallery at all and should try the built-in <txp:images> tag instead, which is versatile enough in the situation to drop suitable markup on the page.

Hope that helps.

Last edited by Bloke (2013-11-12 21:43:22)


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

#932 2013-11-13 04:14:29

robew
New Member
Registered: 2013-11-12
Posts: 2

Re: smd_gallery: super-flexible gallery generator

Bloke wrote:

Congratulations: I think you’ve found a limit to this plugin’s capabilities ;-)

Woot! do I win a prize?

Just knowing it is not capable is a big help, I can put my energy into a work-around.

Offline

#933 2014-03-17 00:42:21

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 133
Website

Re: smd_gallery: super-flexible gallery generator

Bloke

A long, long time ago you assisted me in getting this concatenation together, and what a time that was, happy days.

<txp:smd_gallery id="?article_image"
      delim="@" paramdelim="|" collate="1"
     combo='sc_img| { url: "{url}", description: "{caption}" }'>
   images: [ {sc_img} ],
</txp:smd_gallery>

This is buried in the middle of the javascript and works admirably for individual articles.

<script type="text/javascript">
$("#front_showcase").showcase({
   css: { width: "1080px", height: "500px",},
   animation: { type: "fade", interval: 5000, speed: 1500 },
<txp:smd_gallery id="?article_image"
      delim="@" paramdelim="|" collate="1"
      combo='sc_img| { url: "{url}", description: "{caption}" }'>
  images: [ {sc_img} ],
</txp:smd_gallery>
  navigator: { css:  {    border: "none",
etc

Also, at the moment with each article_list, one in each section, I don’t use smd_gallery, it’s defined with a static setup like this. There’s 11 sections now and rather than using 10 conditionals I’ve created a separate page for each section.

images: [
      { url:"/images/40.jpg",description:”something”},
      { url:"/images/97.jpg", etc
     ],

and that also works OK.

Except. I’ve used adi_menu to break some sections into a number of sub-sections, sometimes 12 or so, and I’d like to have a different image or images with each sub-section. Kinda like this . . .

<txp:if_section name=“x-a”>
   show image a1, a2  
</txp:if_section>
<else />
<txp:if_section name=“x-b”>
 show image b  
</txp:if_section>
<else />
<txp:if_section name=“x-c”>
 show image c1, c2, c3, c4  
</txp:if_section>
<else />
<txp:if_section name=“x-d”>
etc

Whadda ya reckon might be the best way to structure this to incorporate it within the whole mess of the js and bearing in mind these subsections seem to be breeding.

I’ve tried a whole host of things about where to whack in the conditionals but I’m unable to get an image loading.

I guess you can tell there some sort of overall logic missing here. Any suggestions?

cheers,

Graeme

Offline

#934 2014-03-17 05:39:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,107
Website

Re: smd_gallery: super-flexible gallery generator

Hi Graeme,

If you create image categories and subcategories with the same names as your sections you could have something like the untested code below:

<txp:varible name="hassubcategories" value='<txp:category_list type="image" parent=''<txp:section />'' >' />
<txp:if_variable name="hassubcategories" value="">
<txp:images category='<txp:section />' >
<a href="<txp:image />"><txp:thumbnail class="your class" /></a>
</txp:images>
<txp:else />
<txp:images category='<txp:category_list type="image" parent=''<txp:section />'' >
<txp:category type="image" /></txp:category_list>' >
<a href="<txp:image />"><txp:thumbnail class="your class" /></a>
</txp:images>
</txp:if_variable>

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

#935 2014-03-17 20:01:22

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 133
Website

Re: smd_gallery: super-flexible gallery generator

Y

Thanks for that.

Yes, that’s given me a new and better track to explore.

I’ll need to adapt it to the js script, showcase.js is an old, ie, 2010, now discontinued, slideshow that hides the caption until you mouse over it, so it has to include the caption, hence the combo. It was the most adaptable slideshow around at the time. Maybe I should look for a newer script that incorporates the captions automatically, that would simplify the whole mess.

Just as long as I don’t get lost in all those single quote marks . . .

Offline

#936 2014-04-30 04:29:21

detail
Member
From: geez, I seem to be in NZ
Registered: 2010-07-13
Posts: 133
Website

Re: smd_gallery: super-flexible gallery generator

Yiannis

Finally, 6 weeks later, I had time to work through this, the clue was your suggestion to create a gallery with the same category name as the sub-section it was in. I could then switch

id="?article_image"

which was throwing a slideshow, ie, multiple article images, on the individual article pages to

category='<txp:section />' 

for a slideshow on each article list page, all consistently formatted.

I guess this explanation sounds somewhat confusing but maybe this needs to be documented in the Help file because it’s so useful to get images on article list pages where there aren’t any article images.

smd_gallery is unbelieveable, thanks Bloke.

Oh, now I’ve gotta organise 12 odd galleries with 3 images each, shouldn’t take more than 8 hours work . . .

Graeme

Last edited by detail (2014-04-30 04:33:00)

Offline

#937 2015-04-30 14:42:58

miles
Member
From: Plymouth
Registered: 2008-05-22
Posts: 73
Website

Re: smd_gallery: super-flexible gallery generator

I am probably being a bit slow today. Hopefully someone can help. I simply want the user to click on a thumbnail which will bring up a lightbox of that gallery/category of images. I also want the thumbnail to be the last in the set. Is this possible?

Last edited by miles (2015-04-30 14:43:25)

Offline

#938 2015-04-30 15:35:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,611
Website

Re: smd_gallery: super-flexible gallery generator

miles wrote #290317:

click on a thumbnail which will bring up a lightbox of that gallery/category of images. I also want the thumbnail to be the last in the set.

Not sure this is the most elegant way to approach it, but I think it does what you want:

<txp:smd_gallery category='<txp:custom_field name="article_image" />'>
   <txp:variable name="thisImg">{counter}</txp:variable>
   <txp:variable name="imgTotal">{maximages}</txp:variable>
   <a rel="lightbox-{category}" href="{url}">
      <txp:if_variable name="thisImg" value='<txp:variable name="imgTotal" />'>
         <txp:thumbnail id="{id}" />
      </txp:if_variable>
   </a>
</txp:smd_gallery>

Notes:

  • Reads the category name from the article image field.
  • Assumes your lightbox script is already loaded on the page (in this case, the standard lightbox).
  • Since the thumbnail is the last one, your gallery starts from there, thus you need to ensure your navigation wraps at each end or visitors might get confused why they can’t use ‘next’ when they enter the gallery.
  • You can simplify the code if you have smd_if installed to replace the variable/if_variable stuff.

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

#939 2015-05-17 13:48:13

pierlu
Member
Registered: 2014-08-12
Posts: 153

Re: smd_gallery: super-flexible gallery generator

Vorrei fare in modo che sotto ad ogni articolo della sezione “dove dormire” abbia la sua gallery.
Usando plugin smd gallery ho scritto

<txp:if_custom_field name="galleria1"> 
<div class="fotosagra1">
<div class="gallerycascioinfesta">
<h1>Alcune foto </h1>
<txp:smd_gallery category="?agrturismo" form="galleryart"/>
</txp:smd_gallery> </div> </div>
</txp:if_custom_field>

Non Viene niente, cosa sbaglio?

la galleria che ho per ora si chiama “agriturismo-lafoce” e “agriturismo-labetulla”

EDITED: bc.. code added

Offline

#940 2015-05-17 14:31:59

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 3,345
Website

Re: smd_gallery: super-flexible gallery generator

<txp:if_custom_field name="galleria1"> 
  <div class="fotosagra1">
    <div class="gallerycascioinfesta">
      <h1>Alcune foto</h1>
      <txp:smd_gallery category="?agrturismo" form="galleryart" />
    </div>
  </div>
</txp:if_custom_field>

It looks like you have an extra closing </txp:smd_gallery> in there which you don’t need.

If the above is in an article form or an if_individual_article section, it will output the code if you have something in the custom field “galleria1” and show the gallery of images in the image category agrturismo using the galleryart form. Otherwise, check your spelling is correct (is there perhaps an i is missing in the category agriturismo?).


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB