Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-07-15 12:28:07
- stuart_mcnee
- Member
- Registered: 2006-11-17
- Posts: 12
smd_slimbox used in multiple articles per section
smd_slimbox 0.24b
smd_lib 0.21b
OSX 10.4.11
Safari 3.1.2
Firefox 3.0.1
Opera 9.23
Ref http://www.historicroses.org/index.php?s=news
Page shows total 6 articles for section news with two articles (The HRG at Chelsea 2008 and British Bred Roses Project) which use smd_slimbox to display thumbnails using separate article override forms news_img_cat_2 and news_img_cat_3 for image categories news_images_2 and news_images_3 respectively.
Display is correct with x4 and x2 thumbnails shown respectively for articles and with operation passed thru to smd_slimbox to display large image etc.
HOWEVER smd_slimbox shows total of 6 images neglect of article thumbnail source ie x4 or x2 . IF article is called from the section header list of articles ie display individual article (eg http://www.historicroses.org/index.php?id=78) smd_slimbox then shows correct number of enlarged images per article ie in this instance 4
Am I missing something ?
Offline
Re: smd_slimbox used in multiple articles per section
stuart_mcnee wrote:
smd_slimbox shows total of 6 images neglect of article thumbnail source ie x4 or x2
Hello. When the thumbnails are passed to slimbox for display they look for every instance of rel="lightbox-something"
and display it. If the ‘something’ is the same for every article then in your article list situation it will show “image 1 of 6” because there are 6 items in the page source code that have rel="lightbox-smd"
(search your page source and you will see all 6 images have the same ‘rel’).
To get round this, you use the groupname
attribute. For each slimbox tag you should give the groupname a unique name. If you are using the smd_slimbox on a per-article basis you can do this manually, but if it is in a TXP form and you have grouped your images by category — one category per gallery — you will usually add groupname="?c"
to your slimbox tag (see example 4 in the plugin help).
That reads the current image category and uses it as the ‘something’ part of the rel
attribute; so if you had two image categories called “HRG_Chelsea” and “Brit_Bred_Rose”, the first time smd_slimbox is called you would see rel="lightbox-HRG_Chelsea"
in the source, and the 2nd time you would see rel="lightbox-Brit_Bred_Rose"
. smd_slimbox will then treat them as separate groups and only allow you to navigate within the groups.
smd_slimbox 0.24b
smd_lib 0.21b
You probably ought to upgrade from those two versions, they’re way out of date!
Last edited by Bloke (2008-07-15 12:48:34)
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
#3 2008-07-15 14:03:15
- stuart_mcnee
- Member
- Registered: 2006-11-17
- Posts: 12
Re: smd_slimbox used in multiple articles per section
Thanks Stef – now resolved and as suggested will upgrade to latest versions of your plugin.
Offline
#4 2008-12-10 21:33:11
- anbarns
- New Member
- Registered: 2008-12-10
- Posts: 2
Re: smd_slimbox used in multiple articles per section
I’m having a similar issue that I can’t seem to solve (at first it was the exact same issue, but the groupname attribute solved part of it). My thumbnails are no longer listing through every image in my DB, but thumbnails for images are showing up where I don’t want them to.
I am creating a site for a friend, who is even more of a novice than myself, and he will be doing weekly updates posting images of new product that comes into his shop. I would like the set up the page template to display a list of articles (the weekly updates) using a form that has the smd_slimbox tag.
Currently, it is set up like so:
<h3><txp:posted format=”%b|%d” /> <txp:title /></h3> <txp:body /> <div class=“slimbox”> <smd_slimbox groupname=”?c” /> </div>The article category matches that of the image category. That also means that everytime he creates an update, he’ll need to create a new article category as well as a new image category.
Sorry, I’m sure this has been posted before, but I’ve looked through all 57 pages of the smd_slimbox thread and have not found the answer. Thanks.
Offline
Re: smd_slimbox used in multiple articles per section
anbarns wrote:
The article category matches that of the image category. That also means that everytime he creates an update, he’ll need to create a new article category as well as a new image category.
Hello. Yes, that’s a good way to do it because it keeps things nice and neat. If you do that, your tag should work… at least it will when you put txp:
in front of it ;-)
But you probably need to specify a category as well so it’s best to decide which article category (1 or 2) is going to match the image category and stick to that convention. e.g.
<div class="slimbox">
<txp:smd_slimbox category="?category1" groupname=”?c” />
</div>
You could use category="?c"
but that tells Textpattern to look at the “global” category and is only available on category list pages when you are filtering by a single category name (e.g. if the url is http://site.com/category/my-product
, the ?c
would be my-product
. On an individual article page, the article’s ?c
is empty because ?category1
and ?category2
take over).
Confusingly — and I apologise for this stupid naming convention of mine — the ?c
in the groupname
actually refers to the image category, not the article category. That was bad planning on my part and causes no end of confusion — even I get it wrong when I come back to this plugin after a break!
If that’s totally flummoxed you, post some more snippets of code or some of the output of what you expect to achieve or how you are setting up your articles/images and I’ll try and help.
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
#6 2008-12-10 23:09:54
- anbarns
- New Member
- Registered: 2008-12-10
- Posts: 2
Re: smd_slimbox used in multiple articles per section
Hahaha, the txp: was in the actual form. Guess I typed it here in too much of a hurry. I added the ?category and now it appears to be working great, thank you! I’ll post the code as it is now, if you could let me know any mistakes you see, I’d really appreciate it.
So the section calling my form in the template looks like:
<div class="main">
<ul>
<txp:article_custom section="News" form="body-news" limit="15" />
</ul>
</div>
and as of now, the form itself looks like:
<li>
<h3><txp:posted format="%b|%d" /> <txp:title /></h3>
<txp:body />
<div class="slimbox">
<txp:smd_slimbox category="?category1" groupname="?c" />
</div>
</li>
Thank you again for your quick response, this is a really great plugin!
Offline
Re: smd_slimbox used in multiple articles per section
Looks good to me. Whatever is set as the article’s category1 will be used as the image category when looking for potential images for the gallery.
Should be fairly easy to keep updated as the site grows. Let me know if you have any further questions.
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