Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#265 2008-11-11 06:11:34
- mcx
- Member
- Registered: 2008-11-11
- Posts: 12
Re: smd_gallery: super-flexible gallery generator
Great stuff Stef!
However my newbiness prevents me from using all but the most basic of features… I was hoping that someone would be able to point my in the right direction on loading the related images for an article dynamically.
I have the plug-in working up to the point where the correct images load if the <txp:smd_gallery… > tag is place in the article, but once I try to place the tag in either a page or a form (swapping out the static category attribute for a dynamic”?” attribute), it all heads south.
I have tried to emulate a set-up from another plug-in by categorizing the images by the article number to which are associated (e.g. “30”), then using the <txp:smd_gallery category=”?id” form=“gallery” debug=“1”> in either the default page or form.
I suspect that I missing something about the textpattern’s method of retrieving the article id or the correct use of the dynamic id retrieval system. I am pretty sure I will be kicking myself when the answer comes around, moreso if there is a simpler, more refined method achieving the same result.
Thanks for you patience and consideration!
Last edited by mcx (2008-11-11 12:28:26)
Offline
#266 2008-11-11 09:20:42
Re: smd_gallery: super-flexible gallery generator
mcx wrote:
using the <txp:smd_gallery category=”?id” form=“gallery” debug=“1”> in either the default page or form.
Hi mcx. No, you’re not missing anything, that should work (assuming you have the trailing /
in the tag on your site). It works on my test site.
What sort of thing do you see in the debug output? You should see a line that starts with 1=1
. Under that you should see a REPLACEMENTS section with each of your matching images listed and a load of junk about each one. If all you’re seeing is array()
then for some reason the plugin is not pulling out the correct info. Post what you see and I’ll try and figure it out.
If all that looks ok and the first part is pulling the correct stuff out of the database, the next thing to look at is the form. What is the content of your gallery
form? And you’re using v0.45 of the plugin, yes? (I still haven’t fixed the id
attribute bug that I *cough* fixed badly from 0.44, but it shouldn’t affect you here because you are using category
).
You’re approach seems sound and logical. The default form is the right place for the tag, and keying the image category off the article ID is a great way to make “auto galleries” that expand if you add new images. There are other ways, but they all involve an extra step and/or nominating another field to hold the category name, so yours is by far the most efficient method.
So at the moment I’m a bit flummoxed, sorry.
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
#267 2008-11-11 10:52:47
Re: smd_gallery: super-flexible gallery generator
progre55 wrote:
Bloke:
Thanks for the quick reply. I guess I was hoping for something more along the lines of what HP has on their website where you have some controls, as well as the capability to jump around.
progre55
Hey, progre555, the jquery cycle plugin can be made to have controls.
take a look at their advanced demos
i have implemented cycle with pagers/prev next several times, including in my portfolio (shameless plug)
I’d be happy to help out if you have any questions
~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~
Offline
#268 2008-11-11 12:06:54
Re: smd_gallery: super-flexible gallery generator
smd_gallery + smd_if = lot of fun = the infinite is the limit
Offline
#269 2008-11-11 12:10:50
Re: smd_gallery: super-flexible gallery generator
maniqui wrote:
smd_gallery + smd_if = lot of fun = the infinite is the limit
Another satisfied customer :-)
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
#270 2008-11-11 12:25:45
- mcx
- Member
- Registered: 2008-11-11
- Posts: 12
Re: smd_gallery: super-flexible gallery generator
Thanks for the speedy reply Stef – much appreciated!
So I’ve gone through it once more, but have not been able to spot any obvious discrepancies.
Please have a look at the following and let me know where I am getting blind-sided.
In the “default” form:
<txp:smd_gallery category=”?id” sublevel=“1” form=“gallery” debug=“1” />
The “gallery” form:
<a rel=“lightbox-{category}” href=”{url}” alt=”{alt}”
title=“A picture of {title}” height=”{height}” width=”{width}”>
<txp:thumbnail id=”{id}” />
</a>
With in the <head> tag of the “default” page:
<script type=“text/javascript” src=”/js/mootools.js”></script>
<script type=“text/javascript” src=”/js/slimbox.js”></script>
<link rel=“stylesheet” type=“text/css” href=”/css/slimbox.css” />
With this combination the debug prints:
“++ WHERE CLAUSE ++
txp_image.category = “smd_1053391178” ORDER BY txp_image.category asc
select txp_image.name,txp_image.id,txp_image.alt,txp_image.caption,txp_image.category,txp_image.author,txp_image.date,txp_image.ext,txp_image.w,txp_image.h,txp_image.thumbnail, txp_category.title AS category_title from txp_image, txp_category where txp_category.name = txp_image.category AND txp_category.type=“image” AND txp_image.category = “smd_1053391178” ORDER BY txp_image.category asc LIMIT 0,99999”
x5 – with different “smd_…” for each.
I have seen the “1=1” debug output during my various trials but forget by which combination it was produced.
Thanks again for your support!
Last edited by mcx (2008-11-11 12:26:42)
Offline
#271 2008-11-11 12:32:15
- mcx
- Member
- Registered: 2008-11-11
- Posts: 12
Re: smd_gallery: super-flexible gallery generator
Oh and one other thing, I cannot seem to get clean URLs to work with my set-up and have reverted to the mess – not sure if this is possibly contributing the my “?id” problem.
Offline
#272 2008-11-11 12:51:57
Re: smd_gallery: super-flexible gallery generator
mcx wrote:
<txp:smd_gallery category=”?id” sublevel=“1” form=“gallery” debug=“1” />
Hmmm, well the sublevel=“1” isn’t necessary unless your image category contains subcats, but it won’t affect the output.
Your gallery form is fine, your head section is fine. This is where the problem lies:
txp_image.category = “smd_1053391178” ORDER BY txp_image.category asc
See that smd_
with random number attached? It does that when it cannot find the thing you specified in the category
attribute (otherwise, if your category did not match anything it would show all images, which is not what you want).
From this I have two possible scenarios:
- You have not made an image category with the number of the article you are viewing
- The plugin cannot read the
id
for some reason
I doubt it’s number 1, since that’s the whole point of your system, but please double check that the image category name exactly matches the article ID. No spaces and stuff. It doesn’t matter if you have images in that category (well, it does if you want them to show up(!) but from a plugin functionality viewpoint it makes no difference, as it’ll just skip any empty categories).
For number 2, try this: set debug="4"
. You’ll see a tonne of crud on the screen but scan down to find AVAILABLE ‘?’ VARS and look at the ‘id’ attribute on the first line. That’s the ID of the current article you are viewing. If it’s blank, that’ll be the problem. You could try using category="?thisid"
instead, though I can’t remember how that reacts on article list pages. When it works, you’ll see the very first bit of debug will show something like:
++ INCLUDED/EXCLUDED IDs AND CATs ++
array (
)
array (
)
array (
0 => '\'42\'',
)
Where 42 is the number of the current article ID.
If the ‘id’ is blank — either there or in the AVAILABLE ‘?’ VARS section — the next question is to find out why. For that I can’t think of any reason yet, but maybe when we’ve ruled out everything else we can start on that avenue if necessary. I don’t think clean URLs make any difference but I have never used them, hence the plugin has never been tested with them. It could well be that, I just don’t know at the moment.
Does that lot get you going anywhere other than circles?
Last edited by Bloke (2008-11-11 12:54:05)
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
#273 2008-11-11 14:13:06
- mcx
- Member
- Registered: 2008-11-11
- Posts: 12
Re: smd_gallery: super-flexible gallery generator
Thanks again for the speedy help. Will go through your suggestions and try things out.
As for going around in circles – It feels more productive than staring a screen that might as well be blank…
Last edited by mcx (2008-11-11 14:13:31)
Offline
#274 2008-11-11 14:23:11
- mcx
- Member
- Registered: 2008-11-11
- Posts: 12
Re: smd_gallery: super-flexible gallery generator
like a charm… basically, happened just like your reply – checked everything and still came up empty. Sprinkle a little four letter word on the mess and ta-da! Stef – thanks for “this” ;)
Offline
#275 2008-11-11 14:32:13
Re: smd_gallery: super-flexible gallery generator
mcx wrote:
Sprinkle a little four letter word on the mess and ta-da! Stef – thanks for “this” ;)
:-) No probs. Glad it’s sorted. I wonder if the fact that id
is empty when thisid
is populated has something to do with the clean url thing, or whether it is dependend on the URL scheme employed in Basic Prefs… *rhetorical pondering in progress*
Either way I’ll have to document thisid
. I’ve done it in other plugins so it’s only fair.
Last edited by Bloke (2008-11-11 14:33:38)
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
#276 2008-11-16 21:56:07
- curiouz
- Member
- Registered: 2006-06-20
- Posts: 56
Re: smd_gallery: super-flexible gallery generator
Hi Bloke,
I tried setting the delim to '_,_'
, like you suggested, but this causes the combo to be parsed wrong:
combo="test|'{imagedef}': {caption:'{title}'_,_href:'{somecombo}'}"
is parsed as:
'1.jpg': {caption:'bla'_,_href:'bla'};
Last edited by curiouz (2008-11-16 22:00:33)
Offline