Textpattern Forum

You are not logged in. Register | Login | Help

#241 2007-09-11 16:06:55

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

Re: smd_slimbox

Qwest wrote:

Can slimbox load a category depending on a custom field?

Of course! :-) Since day one (give or take a few minor fixes * cough *). It can even read lists of multiple categories from one or more custom fields if you want. I believe Ruud’s solution would also work (thanks for the suggestion), but there should be no need since it’s native to the plugin.

Just use:

<txp:smd_slimbox category="?custom1" />

Or if you’ve renamed custom1 in the admin panel, use that name instead.

The only thing that might cause you grief is the fact that it’s a date and, until fairly recently, there was a bug that caused it to interpret ’2007-09-10’ as a range of numbers. Hopefully that’s (kinda) fixed in the latest v0.21d (also see this post about it for the only known caveat) but you’ll be the first real live field trial I know of, so let me know how you get on.

Last edited by Bloke (2007-09-11 16:08:27)


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

Txp Builders – finely-crafted code, design and Txp

Offline

#242 2007-09-12 03:58:35

Simanek
New Member
From: Lincoln, Nebraska, U.S.A.
Registered: 2007-09-12
Posts: 5
Website

Re: smd_slimbox

This is really great and almost perfect:

1 img tag width and height values should always be provided in xhtml. I see you have those values available to be inserted into the alt value, so perhaps this is an easy addition.

2 An option to set the img tag ‘border’ value to zero is a must. This cannot be set via css to my knowledge. Without that, the linked image will always show a border.

I’m not much with scripting, but if I can help let me know.

Offline

#243 2007-09-12 05:14:05

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: smd_slimbox

Simanek wrote:

2 An option to set the img tag ‘border’ value to zero is a must. This cannot be set via css to my knowledge. Without that, the linked image will always show a border.

I’m not much with scripting, but if I can help let me know.

a:link img { border:0;}

works fine for me

Last edited by iblastoff (2007-09-12 05:15:20)

Offline

#244 2007-09-12 08:44:28

Qwest
Member
From: London, UK
Registered: 2007-01-24
Posts: 112

Re: smd_slimbox

Bloke wrote:

The only thing that might cause you grief is the fact that it’s a date and, until fairly recently, there was a bug that caused it to interpret ’2007-09-10’ as a range of numbers. Hopefully that’s (kinda) fixed in the latest v0.21d (also see this post about it for the only known caveat) but you’ll be the first real live field trial I know of, so let me know how you get on.

Bloke, thanks for the reply! Seeing as im your human guinea pig, i’d love to give this a go, but it needs some more thought first, and possibly the inclusion of an IF tag along the way!.

Basically, it’s a nightclub website. They put on an event every month (weekly during the summer), and each event has it’s own page.

event’s dont get posted in chronological order. I could get details of the december event tomorrow, and then details for the november event in a weeks time (dont ask!), SO, i have to use a custom field to input the event date (ie: 2007-09-10) to the schedule is shown in the correct date order (next event at the top, later ones below etc).

Now that works fantastic.

My idea was to upload the pictures from each event into a separate category (Which uses the date as a category name ie: 2007-09-10). This category name will correspond with the date i put into the custom_field earlier to get the events sorted chronologically.

So then in my form, i’d put in a bit of code saying <txp:smd_slimbox category=”?event_date” /> and it’d pull in the pictures from that event and show them!

But it has several fatal flaws.

1) If there’s no pictures in that gallery, will it produce an error on the page?

2) In effect, i’d have the pictures appearing in 2 seperate places on the site (in the gallery AND the event page).

So what i’ve done, is with each event that i receive pictures, i upload them to my gallery, and then copy the link, and paste it into another custom field of the actual event.

Then i use an IF decleration, if the custom_field is full, then link to it with a “View the Gallery” link, if not, then don’t show anything…

And you can see that in action here : http://eliteproductions.co.uk/history – Several of the events will have a gallery, most wont though!

Hands up who understood?! LOL!

Offline

#245 2007-09-12 12:43:36

Simanek
New Member
From: Lincoln, Nebraska, U.S.A.
Registered: 2007-09-12
Posts: 5
Website

Re: smd_slimbox

iblastoff wrote:

a:link img { border:0;} works fine for me

Okay, apparently there’s always something to learn. I still don’t quite get why ‘img { border:0; }’ doesn’t work since it’s a value of that element, but that’s not for this forum. Also, I couldn’t get this to work from my stylesheet, I had to imbed it in the page itself. That might have something to do with inheritance I can only guess.

I’m still curious about the width and height values with this plugin, but thank you for the beginner’s level CSS lesson. I thought I knew CSS.

Offline

#246 2007-09-12 14:46:12

Qwest
Member
From: London, UK
Registered: 2007-01-24
Posts: 112

Re: smd_slimbox

Further to my previous post, for some reason, TXP & SMD_SLIMBOX doesn’t accept image category’s which use hyphens?! I tried using category’s called 2004-11-13 & 2004-03-29. These wouldn’t work but when i removed the hyphens, they did!

Just thought i’d let yo know (if you didn’t already ;) )

Offline

#247 2007-09-12 19:43:19

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

Re: smd_slimbox

Simanek wrote:

img tag width and height values should always be provided in xhtml.

You’re right, and to be honest I hadn’t spotted that the thumbnails didn’t have width/height attributes, oops! Then I found something interesting: nobody I know has them on their thumbnail output either; not even rss_thumbpop or zem_article_thumb. I checked the code of a few other plugins and nope, no mention.

Then I checked the TXP database and found why: the thumbnail width and height aren’t in there! So automatically assigning them is not possible without reading each image file in turn, checking its height and width and then setting the tag appropriately. That would probably slow the plugin down quite a lot, though if anyone knows otherwise or a neat way of doing this, please holler.

(btw, you must be the only person I know who validates to xhtml, which is probably why it’s not cropped up before! In my limited experience, as soon as I serve the page as application/xhtml+xml instead of text/html all browser hell breaks loose, so I give up)

If having thumbnail width/height on the page is causing you validation problems I could certainly add a plugin option that allows you to specify fixed thumbnail dimensions for all thumbs on the page. Would that be helpful? It would mean that all thumbnails would be scaled to the same size by the browser if they didn’t match the given dimensions, which I guess is not much of an issue for most galleries: I would expect fixed thumbnail sizes are the norm? Anyone any different opinions?

As for your other CSS issue, thanks iblastoff for jumping in with the fix. I agree it sounds like an inheritance/specificity issue that the img { border:0; } doesn’t work. a:link img { border:0;} is more specific so it’ll take priority over any other img rule lurking.

Last edited by Bloke (2007-09-12 20:33: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

#248 2007-09-12 20:30:30

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

Re: smd_slimbox

Qwest wrote:

i have to use a custom field to input the event date (ie: 2007-09-10) to the schedule is shown in the correct date order…

Sounds logical. It’s how I’d do it; it’s more flexible than setting the article to a date in the future.

My idea was to upload the pictures from each event into a separate category (Which uses the date as a category name ie: 2007-09-10)

Again, perfectly reasonable, and exactly the sort of set up that smd_slimbox (and smd_random_banner) was designed for.

in my form, i’d put in a bit of code saying <txp:smd_slimbox category=”?event_date” /> and it’d pull in the pictures from that event and show them!

Yup, exactly right.

1) If there’s no pictures in that gallery, will it produce an error on the page?

Not at all. No pictures = nothing output to the page.

2) In effect, i’d have the pictures appearing in 2 seperate places on the site (in the gallery AND the event page).

Not necessarily. Only if a) you use the same form for both pages (without any conditional logic) or b) you put all images in the same directory.

Here’s how I’d do it:

  • set up an image category called events
  • set up another image category called 2007-09-10 and set its parent to be events (keeps things neat)
  • each subsequent event gets its own gallery named with the date of the event in exactly the same manner; that way your gallery and your event images can be treated separately
  • in your article form for the events page, specify <txp:smd_slimbox category="?event_date" />
  • in your article form for the gallery page, specify <txp:smd_slimbox category="gallery" />

Assuming you have some images assigned to the date category for a particular event, they will be shown on the event page, but not in the gallery (incidentally, if you did ever want to display them together: <txp:smd_slimbox category="gallery, events" subcats="1" />)

for some reason, TXP & SMD_SLIMBOX doesn’t accept image category’s which use hyphens?! I tried using category’s called 2004-11-13 & 2004-03-29. These wouldn’t work but when i removed the hyphens, they did!

Well that is most strange. I just created an image category called 2007-09-23 and it made it fine in one of my sites. I then set up a test page with this tag in it: <txp:smd_slimbox category="?Image_list" /> (Image_list is my custom2 field) and the page showed nothing (as expected). I then uploaded a couple of images and assigned them to the 2007-09-23 image category, refreshed the page and voila! The image thumbs appeared. That was with smd_slimbox v0.28 and smd_lib v0.21d under TXP 4.0.5.

Now I know that’s not much help to you, but it does work. There must be something screwy with your setup if it’s not accepting category names with hyphens in them. When you say “does not accept” the category names, what does it do exactly? Just return you to the category page with no new category created? Or give an error message? Or make the category but automatically remove the hyphens in the process so it reads 20041113? If your version of TXP checks out, perhaps it’s your hoster or some firewall getting in the way between you and TXP and making some bad assumptions about the content it’s being given?

Sorry I can’t be of much more help right now. All I can say is the way you want it to work is perfect for smd_slimbox and it will work sweetly one day! It sounds like you just need to narrow down at which point in the process it’s falling over; your browser, personal firewall, corp firewall, TXP/MySQL/PHP version/installation, the site pages/forms, server/ISP…

Good luck.


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

Txp Builders – finely-crafted code, design and Txp

Offline

#249 2007-09-13 01:58:25

Simanek
New Member
From: Lincoln, Nebraska, U.S.A.
Registered: 2007-09-12
Posts: 5
Website

Re: smd_slimbox

Bloke wrote:

— “Then I checked the TXP database and found why: the thumbnail width and height aren’t in there!”

Apparently writing valid xhtml isn’t a priority for Textpattern (though I know it is). Oh well. There are more important fights to fight.

— “(btw, you must be the only person I know who validates to xhtml, which is probably why it’s not cropped up before! In my limited experience, as soon as I serve the page as application/xhtml+xml instead of text/html all browser hell breaks loose, so I give up)”

Yeah, you’re right that +xml screws things up. I just do my best to stick to the W3C’s recommendation. I’m pretty sure you can still validate to xhtml while serving your content as text/html. I just have a hard time seeing the line in the sand if I start letting certain html4 things exist in my xhtml documents.

I’m also picky about using UTF-8 encoding where a lot of designers in this industry in the U.S. are still using ASCII or ISO-8859-1 (mostly out of complete ignorance). The continued use of ASCII in the U.S. is about as bad as our continued use of the Imperial measurement system.

Thanks for your help and generosity!

Offline

#250 2007-09-13 10:17:09

Qwest
Member
From: London, UK
Registered: 2007-01-24
Posts: 112

Re: smd_slimbox

Bloke wrote:

Well that is most strange. I just created an image category called 2007-09-23 and it made it fine in one of my sites. I then set up a test page with this tag in it: <txp:smd_slimbox category="?Image_list" /> (Image_list is my custom2 field) and the page showed nothing (as expected). I then uploaded a couple of images and assigned them to the 2007-09-23 image category, refreshed the page and voila! The image thumbs appeared. That was with smd_slimbox v0.28 and smd_lib v0.21d under TXP 4.0.5.

Now I know that’s not much help to you, but it does work. There must be something screwy with your setup if it’s not accepting category names with hyphens in them. When you say “does not accept” the category names, what does it do exactly? Just return you to the category page with no new category created? Or give an error message? Or make the category but automatically remove the hyphens in the process so it reads 20041113? If your version of TXP checks out, perhaps it’s your hoster or some firewall getting in the way between you and TXP and making some bad assumptions about the content it’s being given?

Sorry I can’t be of much more help right now. All I can say is the way you want it to work is perfect for smd_slimbox and it will work sweetly one day! It sounds like you just need to narrow down at which point in the process it’s falling over; your browser, personal firewall, corp firewall, TXP/MySQL/PHP version/installation, the site pages/forms, server/ISP…

Good luck.
=================

bloke, thank’s for your help, although somewhere along the lines (probably my ‘does not accept’ line), it’s got confusing.

My Textpattern does accept hyphens in category names. I can upload hundreds of photos to a category called 2007-09-23. But when i call <txp:smd_slimbox category="2007-09-23" /> it does nothing. No images or code appears =\.

However, if i rename the category to 20070923 and change the code to <txp:smd_slimbox category="20070923" />, it works fine :s

But it’s not a problem, i’ll just remove the hyphens… The hyphen just makes the date more human.

Btw, i’m running txp 4.0.4, smd_lib 0.21b & smd_slimbox 0.28

===================

edit: I’ve just installed smd_lib 0.21d and the problem appears to have rectified itself… or i was doing something wrong yesterday ;)

Last edited by Qwest (2007-09-13 10:25:14)

Offline

Board footer

Powered by FluxBB