Textpattern Forum

You are not logged in. Register | Login | Help

#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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

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:

  1. You have not made an image category with the number of the article you are viewing
  2. 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.

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

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

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.

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

#277 2008-11-16 22:38:06

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

Re: smd_gallery: super-flexible gallery generator

curiouz wrote:

I tried setting the delim to '_,_', like you suggested, but this causes the combo to be parsed wrong:

Hehe, sorry, my instructions were a tad ambiguous last time. I actually meant to set delim="_,_" and then change every other occurrence of plain commas into _,_ but leave the one in the combo alone.

For example if you had:

category="cat1, cat2, cat3" id="?custom1, 42"

that should read:

category="cat1_,_cat2_,_cat3" id="?custom1_,_42" delim="_,_"

The delim option governs which characters are used to split regular attributes (comma by default). Overriding it means you have to change everywhere you’d normally use a comma to use your new sequence of characters instead. Then the combo itself is free to use the comma unhindered. Does that make sense?

However, when I just tried it I found an unforeseen problem with this approach: if you use my (foolishly chosen) sequence of characters _,_ and put the smd_gallery tag in an article, guess what? Textile gets in the way and converts the comma into an italicized comma, thus the whole tag breaks! The solution if you are using it in an article is of course to either turn off Textile processing or use a better delimiter. The double colon works well, I tried it and the combo renders fine with all other commas in other attributes replaced with ::.

Sorry for not making myself clear earlier. I assure you it works but if you still have problems, post your full smd_gallery tag and I’ll see if I can figure out what’s going wrong.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#278 2008-11-16 23:34:23

curiouz
Member
Registered: 2006-06-20
Posts: 56

Re: smd_gallery: super-flexible gallery generator

Thanks for the quick reply! Still not working though.

Changing delim to ::, also affects the splitting of attributes in the script tag, so:

<txp:smd_gallery category="slideshow" form="slideshow" collate="{test}" combo="test|'{imagedef}': {caption:'{title}', href:'{alt}'}" paramdelim="|" delim="::"/>

is parsed as:

var data = {'3.jpg': {caption:'bla', href:'bla'}::'4.jpg': {caption:'bla2', href:'bla2'}

I use this form:

<div id="slideshowwrap">
<div class="slideshow" id="show">
<img src="<txp:site_url />images/{id#1}.jpg" alt="{alt#1}" />
</div>
</div>

<script type="text/javascript">
var data = {{test}};
var myShow1 = new Slideshow('show', data,
{controller: true, hu: 'http://jonasdesign.nl/concept/energielive/images/', width: 50, height: 65, duration: 800, delay: 8000,loader:false,paused:false,captions:{duration: 800}, linked:true});
</script>

Offline

#279 2008-11-17 00:28:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,800
Website

Re: smd_gallery: super-flexible gallery generator

curiouz wrote:

Changing delim to ::, also affects the splitting of attributes in the script tag

Oh bollocks, you’re totally right. I didn’t test it with collate mode on. Sorry about that, here’s me saying it’s working and it plainly isn’t :-(

Try v0.46 | zipped which adds the collatedelim attribute. That allows you to specify what you want to put between collated items (instead of it stupidly using delim like it did before). The default is a comma so you should be good to go without any extra attributes required. Thanks for your patience at getting this problem through my thick skull.

I also took the opportunity to (hopefully once and for all) fix the bug nardo reported, that resulted in duplicate IDs. It was a hangover from me attempting to fix the bug that robin746 found a few posts before. Many thanks to all who have highlighted bugs in my slapdash code!

Last edited by Bloke (2008-11-17 00:29:56)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern.

Txp Builders – finely-crafted code, design and Txp

Offline

#280 2008-11-17 01:24:15

curiouz
Member
Registered: 2006-06-20
Posts: 56

Re: smd_gallery: super-flexible gallery generator

I really appreciate all your help! thanks a lot!

I still can’t get the combo to be parsed right though. The href part of the following combo:

combo="test|'{imagedef}': {caption:'{title}', href:'{alt}'}"

isn’t parsed when I use a comma between caption:'{title}' and href:'{alt}'. When I use :: there, the href part does get parsed… I can’t set collatedelim to something else, because then the splitting of attributes in the script tag won’t be right. So I think what I need is an option that replaces a custom delimiter between combo tags to a comma (combodelim maybe??)… man, this is getting complicated…

Offline

Board footer

Powered by FluxBB