Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-03-10 17:13:03
- jmart
- Member
- Registered: 2008-08-25
- Posts: 68
Creating a photo gallery using smd plugins
I can’t seem to get my photo gallery to display the pictures properly on this site: http://www.roofingbyelite.com/projects/gallery
I have this working on a previous site so I can’t undererstand what is happening; http://www.fitnessforgenerations.com/gallery
I’m hoping someone could point out what I did wrong. I have to believe it’s something so minor that I’m overlooking it
I have the following plugins installed: smd_gallery, smd_if, smd_lib, jmd_img_selector
the page template has this
<txp:if_article_list>
<txp:article_custom section="gallery" form="gallery" sort="posted asc" limit="9999" />
<txp:else />
</txp:if_article_list>
Form looks like this;
<txp:smd_gallery id="?article_image" sort="fixed">
<div class="gallery">
<txp:smd_if field="{counter}" operator="eq" value="1">
<div class="main-image">
<a href="{url}" rel="lightbox-gallery-<txp:article_id />" title="{caption}">
<txp:thumbnail id="{id}" />
<small><txp:title /></small>
</a>
</div>
<txp:else />
<div class="extra-images">
<a href="{url}" rel="lightbox-gallery-<txp:article_id />" title="{caption}">Gallery "<txp:title />" - Image ({counter})
</a>
</div>
</txp:smd_if>
</div>
</txp:smd_gallery>
Last edited by jmart (2010-03-10 17:33:47)
Offline
Re: Creating a photo gallery using smd plugins
looking at the tag trace: You’re not in an article list context:
<txp:if_article_list>
[<txp:if_article_list>: false]
</txp:if_article_list>
edit: so you should call the article tag before you call <txp:if_article_list>
Last edited by JanDW (2010-03-10 18:31:11)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
#3 2010-03-10 19:09:54
- jmart
- Member
- Registered: 2008-08-25
- Posts: 68
Re: Creating a photo gallery using smd plugins
That’s not the issue considering I’m using the same code for the other site that does work.
I also just took out the tags altogether and have the following but nothing still shows up;
<txp:article_custom section="gallery" form="gallery" sort="posted asc" limit="9999" />
Offline
Re: Creating a photo gallery using smd plugins
JanDW is onto something. The tag trace shows no calls to smd_gallery so your gallery form is not being processed at all.
First assertion: how many articles are in your section called gallery? That’s the number of times the gallery form will be called. Currently it’s being called zero times.
Second assertion: the URL you supplied http://www.roofingbyelite.com/projects/gallery is of the form site/section/article. Therefore JanDW is correct that if_article_list will not be called because that page is an individual article and not a list.
Last edited by Bloke (2010-03-10 19:24:18)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#5 2010-03-10 19:40:46
- jmart
- Member
- Registered: 2008-08-25
- Posts: 68
Re: Creating a photo gallery using smd plugins
There is only 1 article in the section, Projects. And that would be www.roofingbyelite.com/projects/gallery . Having realized that, the photos should be appearing in the url; www.roofingbyelite.com/projects because this is in an article list context. My bad. So this should still be working just like the other site. I just gave the wrong url, that’s all.
Offline
Re: Creating a photo gallery using smd plugins
jmart wrote:
There is only 1 article in the section, Projects.
I’m officially confused :-s
I asked how many articles are in the section called gallery because that’s the section you’re asking <txp:article_custom /> to look in. I just tried to visit http://www.roofingbyelite.com/gallery and got a 404 which implies there’s no section called gallery and therefore the article_custom tag is, in fact, doing its job properly; i.e. calling the gallery Form for each article from a section that doesn’t exist!
Last edited by Bloke (2010-03-10 19:48:07)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#7 2010-03-10 20:11:52
- jmart
- Member
- Registered: 2008-08-25
- Posts: 68
Re: Creating a photo gallery using smd plugins
Doh. I see what you mean. That is an oversight on my part. Apologies.
The article custom tag was calling the section, gallery, when there was none. I had the section named as “projects”. I’ve since fixed this and renamed the section to gallery so the new url is www.roofingbyelite.com/gallery Everything else remains the same, but still no go.
Offline
Re: Creating a photo gallery using smd plugins
jmart wrote:
Everything else remains the same, but still no go.
OK, now we’re getting somewhere! So it looks like the plugin is choking on the sort="fixed". Can you put debug=“1” or debug=“2” on in your smd_gallery tag and leave it on for a bit so I can take a look at your page and see if I can figure out why it thinks there are no images in your article_image fields. Thanks.
Last edited by Bloke (2010-03-10 20:20:50)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#9 2010-03-10 20:27:20
- jmart
- Member
- Registered: 2008-08-25
- Posts: 68
Re: Creating a photo gallery using smd plugins
where in the plugin do I go to input debug=“1” ?
like this? <txp:smd_gallery id=”?article_image” sort=“fixed” debug=“1”>
Last edited by jmart (2010-03-10 20:29:34)
Offline
Re: Creating a photo gallery using smd plugins
Thanks, I saw some debug output for a moment there. It looks like the plugin is looking for images 4, 5, 6 and 3 in that order. I assume those image IDs exist and contain valid images? (gotta check all bases here when things like this go sideways!)
(add debug=“2” to the smd_gallery tag itself in your gallery form)
EDIT: and are those images assigned to a category?
Last edited by Bloke (2010-03-10 20:34:35)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#11 2010-03-10 20:41:59
- jmart
- Member
- Registered: 2008-08-25
- Posts: 68
Re: Creating a photo gallery using smd plugins
Yep- the images are definitely there. But they aren’t assigned a category.
I added debug=“2”
Offline
Re: Creating a photo gallery using smd plugins
jmart wrote:
like this? <txp:smd_gallery id=”?article_image” sort=“fixed” debug=“1”>
Yup, perfect.
If those four images I mentioned all exist on your Images tab and they’re not categorised then I have a suspicion I know what the problem is — it’s something I kinda knew would come back and bite me one day, but just hoped nobody would find :-)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: Creating a photo gallery using smd plugins
jmart wrote:
Yep- the images are definitely there. But they aren’t assigned a category.
Rats. Stupid bug in the plugin that I’ve been meaning to address for the last year and never quite got round to investing the time to fix. Is it too much trouble to ask you to stick those images in a category for the time being? That should fix things for now. If it’s going to cause you a major problem over time then I can see if I can fix the plugin once and for all.
Sorry for the hassle this is causing.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#14 2010-03-10 21:08:35
- jmart
- Member
- Registered: 2008-08-25
- Posts: 68
Re: Creating a photo gallery using smd plugins
No worries. If inputting categories will fix, then that’s fine. But can you tell me where to correct the tag in the form and where ever else it needs to be corrected. I’m still new to your plugin so the learning curve is steep. Note that I will have multiple albums on this page so should I assign each album a different category?
Though, I’m curious as to why my other gallery on the other site works but doesn’t work here.
Last edited by jmart (2010-03-10 21:11:50)
Offline
Re: Creating a photo gallery using smd plugins
jmart wrote:
But can you tell me where to correct the tag in the form and where ever else it needs to be corrected.
You shouldn’t need to do anything to your smd_gallery tag (besides remove the debug bit!) as simply putting your images in a category — any category — will make the plugin behave. I’ve just whipped up what I thought was a fix, but it breaks something else in the plugin so I’m trying to figure that out now.
I will have multiple albums on this page so should I assign each album a different category?
That’s entirely up to you. If you are happy to assign your images to an article using a list of IDs in the article_image field then you can assign your images to any category you like. However, a nice approach to multiple galleries is to actually create logical categories for them to reside in. That means you have more options open to you later.
For example, you could simply put the name of the category in the article_image field (or any custom field) and have the plugin read that value as its category. It will then create the gallery from all images in that category. So if you add images to a collection, once they are added to the category the plugin automatically picks them up and adds them to your page without you having to do anything else. You can also list more than one image category in your article image / custom field if you wish and it’ll make a gallery from all of the images it finds.
You could be even more clever and tie the image category to the article category (call them the same name) so you don’t need to rely on someone entering the category name in a custom field. Or if your article naming convention was quite strict in this section, you could use (parts of) the article title as the category to grab images from. It really is only limited by your imagination here.
The other thing that categorising images allows you to do is easily make multiple lightboxable galleries on a single page. There’s an example of this in the documentation but as a quick teaser you could set up your nested image categories like this:
portfolio
|--> bloke
|--> jmart
|--> jandw
|--> ...
Then in your smd_gallery tag you could tell it to grab all images from category="portfolio" sublevel="1" and it’d get all images from all sub-categories of your portfolio main category. In your smd_gallery Form/container you could then tell it to add a heading above each change of category so you could display a single page containing the images from each artist. And the beauty is that if you add an image to an artist category or add a completely new artist to your portfolio, the plugin keeps track of it all for you and expands the page automatically.
Category support is where this plugin really shines so I would encourage you to use them. But if you prefer not to, that’s fine!
I’m curious as to why my other gallery on the other site works but doesn’t work here.
Probably because your images were categorised.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline