Textpattern Forum

You are not logged in. Register | Login | Help

#41 2007-02-14 04:50:46

tollady
Member
Registered: 2006-12-06
Posts: 13

Re: smd_slimbox

Is there any way to add a class to just one of the cells? For example, I would like my output to be:

<a href=”#”><Img blah blah /></a>
<a href=”#”><Img blah blah /></a>
<a href=”#” **class=“className”**><Img blah blah /></a>

or

<a href=”#”><Img blah blah /></a>
<a href=”#”><Img blah blah /></a>
<div **class=“className”**><a href=”#”><Img blah blah /></a></div>

I figure it may be possible in combination with “ this tag but I’m not sure how.

Many thanks.

Last edited by tollady (2007-02-14 04:53:43)

Offline

#42 2007-02-15 10:18:25

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

Re: smd_slimbox

tollady wrote:

Is there any way to add a class to just one of the cells?

As soon as you said this, I thought of how cool it would be to allow a different class at particular positions or every nth step, then followed your link to zem_nth!

I doubt we’ll be able to use zem_nth directly because of the tags-in-attributes limitation. But I don’t see any reason why it shouldn’t be possible to build that functionality into the plugin. I would want it to be flexible though so I propose the following idea… not thought it through yet so it may not be feasible but I think I can pull it off:

  • Allow more than one class to be specified for all *class attributes, e.g. cellclass="cell,cellalt,cellother"
  • Extend the class options in a similar way to the orderby tag. So you can specify modifiers to each classname to indicate the steps to which that class should be applied

I would allow any and all combinations of modifiers (wouldn’t want to limit your creativity!) so examples of the new syntax might be:

cellclass="mycell:odd, cellalt:even"

To add class mycell at 1,3,5… and cellalt at 2,4,6… etc.

cellclass="mycell:pos=3"

To force the mycell class to appear for the third thumbnail only on each page.

cellclass="mycell:pos=3;5"

To force the mycell class to appear for the third and fifth thumbnail on each page.

cellclass="mycell:pos=3-7;10"

To force the mycell class to appear for the third thru seventh thumbnail on each page, and the 10th.

cellclass="mycell, cellalt, cellother"

To loop over those three classes in the order given. So 1st thumb gets mycell, 2nd gets cellalt, third gets cellother, fourth gets mycell… etc.

captionclass="mycap:step=4"

Every fourth caption is given class mycap.

cellclass="mycell:step=2, altcell:step=3"

To add the mycell class to every other cell (same as mycell:even) and altcell every 3rd image.

At places where they clash (e.g. the 6th image) the last example would add both classes to that cell, so we would need another option to specify what behaviour the plugin should take when it detects a clash. Haven’t decided how to do that yet. Maybe a new global option classclash="1" or "0" to either allow or disallow multiple class defs per item? If you choose to disallow it, classes appearing first in your list take precedence. And any pos= modifiers take top priority.

Does that make sense?

For the ‘page’ level classes (e.g. navclass, prevclass, nextclass) the step values would dictate on which page those classes are applied. So navclass="mynav:step=3" means every third page give the nav area the classname ‘mynav’.

Before I take the plunge and see if I can add all this:

  1. Do you think the system would work, or is it too confusing?
  2. Besides, pos, step, even and odd, can you think of any more situations or modifiers people might need or conceivably use?
  3. Do you think the default for clashes should be “0” (always take the class order as precedent) or “1” (allow multiple defs per class)? Which makes more sense?

Your (or anyone’s!) input would be appreciated.

Of course, then I’ve just got to see if my coding’s up to scratch and deliver it… eeek!


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

Txp Builders – finely-crafted code, design and Txp

Offline

#43 2007-02-16 00:22:01

tollady
Member
Registered: 2006-12-06
Posts: 13

Re: smd_slimbox

That sounds great! Not sure if you need to get too complicated with it. The options in zem_nth seemed enough.
Your plans for pos, step, even and odd sound perfect.
Good luck. I’m looking forward to using it!

Offline

#44 2007-02-28 12:00:47

Spiceworm
New Member
Registered: 2007-02-28
Posts: 1

Re: smd_slimbox

I get this error:
tag_error <txp:smd_slimbox/> -> Warning: implode(): Bad arguments. on line 277

I think it is an installation error, but i can’t figure out what i’ve done wrong, i’ve placed the JS and CSS directory’s in both textpattern dir’s (www/textpattern/* and www/textpattern/textpattern/*

I’ve the feeling that i should place a php include somewhere?

edit:
i had to include <txp:smd_slimbox_inc jsdir=”/textpattern/js” cssdir=”/textpattern/css” />

while the JS and CSS directory’s are in the textpattern root dir. It probably has something to do with easyphp’s configuration, but thanks anyway.

Last edited by Spiceworm (2007-02-28 14:20:08)

Offline

#45 2007-02-28 23:56:57

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

Re: smd_slimbox

Spiceworm wrote:

I get this error:
tag_error <txp:smd_slimbox/> -> Warning: implode(): Bad arguments. on line 277

Eeeek, that’s not supposed to happen, even if you do forget to use <smd_slimbox_inc />. It’s supposed to complain that you haven’t used smd_slimbox_inc and then stop dead in its tracks.

This error shouldn’t even appear if you use smd_slimbox_inc but give it the wrong location to find the js/css files, because all that does is govern the slimbox part of the plugin, not the thumb generation, which is where the error occurred. Can you remember what options you gave the plugin? Maybe I can figure it out from there.

I think I understand why it can appear (stupid coding assumption on my part), but can’t figure out the exact situation under which it does appear, if that makes any sense. Anyway, since it’s not a major issue I’ll try a fix for it in the next release. I’ve started a dev version of 0.22 that hopefully fixes that, plus it uses my new plugin library (smd_lib). That opens up the possibilty of enabling sub-categories, which is a major bonus.

When I get time I’ll build in the ‘nth class’ functionality for tollady too. And, if I’m feeling particularly adventurous, I may even add support for net-carver’s awesome Multi-lingual Publishing pack. There’s only two internal strings to localise in this plugin, but it’d be nice to have it in for completeness and for the localisation of captions/alts (plus it’s good practise). If you’re contemplating a multi-language site, you really need the MLP extension; it truly is brilliant.

Watch this space for the next rev in the next, umm, parsec or two.

Last edited by Bloke (2007-03-01 00:45:51)


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

Txp Builders – finely-crafted code, design and Txp

Offline

#46 2007-03-01 00:35:58

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: smd_slimbox

Support for MLP would be great.

Offline

#47 2007-03-04 03:34:43

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

Re: smd_slimbox

lee wrote:

Support for MLP would be great.

Done. v0.22 also adds subcat=“1” which allows you to automatically pick up images in any subcategories. e.g. :

<txp:smd_slimbox category="reptiles" subcats="1" />

Would show images from the reptiles category as well as any sub-categories beneath it you may have defined such as crocodiles, alligators, snakes, politicians, etc.

The category / imageid options have also been extended. For categories, as well as ?c, !c, ?field and !field you can now specify:

  • ?s to use the current article’s section as an image category name.
  • !s to use everything except the current article’s section as an image category name.
  • ?t to use the current article’s url-title as an image category name.
  • !t to use everything except the current article’s url-title as an image category name.
  • ?id to use the current article’s ID (prepended with catlabel) as an image category name.
  • !id to use everything except the current article’s ID (prepended with catlabel as an image category name.

For the imageid attribute you can use ?id, !id, ?field and !field.

There are plenty of examples in the plugin help to give you an idea of what it can do. After that, you can mix and match options and experiment away until your browser implodes. Let me know how you get on.

Important Note: the plugin now requires v0.2 of the shared library smd_lib which is included in the download package for convenience. Don’t forget to install and activate it. If you’re using the latest version of smd_random_banner, it’s the same animal.

(P.S. next on the list is tollady’s nth class options – been messing around with MLP a lot this week, sorry)

Last edited by Bloke (2007-03-04 03:40:07)


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

Txp Builders – finely-crafted code, design and Txp

Offline

#48 2007-03-04 03:37:14

mrdale
Moderator
From: Walla Walla
Registered: 2004-11-19
Posts: 2,057
Website

Re: smd_slimbox

orderby, orderby, orderby…

How would I acheive the following; from the selected categories, select the 10 newest images, then put them in random order…

neither orderby="random,date:desc" nor orderby="date:desc,random" seem to work

Offline

#49 2007-03-04 03:52:09

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

Re: smd_slimbox

mrdale wrote:

How would I acheive the following; from the selected categories, select the 10 newest images, then put them in random order… neither orderby="random,date:desc" nor orderby="date:desc,random" seem to work

Erm * cough * you wait until I fix the code to allow that. Sorry, I didn’t test all the combos with randomness in them :-(

I can now see I have to do something slightly different depending where in the orderby list you place the random option. I’ll have a play with it tomorrow and get a fix out asap. Right now, it’s 4am and I’m having trouble typwiepasnaergl6tr*&


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

Txp Builders – finely-crafted code, design and Txp

Offline

#50 2007-03-04 14:19:57

decoderltd
Member
From: London
Registered: 2006-06-20
Posts: 248
Website

Re: smd_slimbox

Hi Stef,

Man thanks for the ability to display images by parent category, makes life much easier.

One question, I’m a little confused about how to display the images by child category, you mention using CSS2 and the ‘rel’ attribute in your help file, but I’m not sure I really follow. My tag is currently:
<txp:smd_slimbox category="gallery" subcats="1" orderby="category" groupname="?c" />

If I could crack this, then the gallery page would pretty much update itself as new child categories are added – it will be non-techy people using the site once it’s finalised.

Offline

Board footer

Powered by FluxBB