Textpattern CMS support forum

You are not logged in. Register | Login | Help

#211 2008-08-27 23:51:57

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: smd_gallery: super-flexible gallery generator

xzamen wrote:

How do I exclude images that doesn’t belong to any category (empty)?

A very good question! If you use a category (any category) then it will automatically exclude them, but if you only want to show images in a gallery that are categorized I don’t think the plugin can do it… yet. I could (probably) add some special trigger that allowed you to include or exclude uncategorized images but for now the best I can offer is to use the conditional plugin smd_if. Your gallery tag:

<txp:smd_gallery form="only_cats" />

When no category or id attributes are specified, that tells the plugin to extract all images. Then in the only_cats form:

<txp:smd_if field="NULL" operator="not" value="{category}">
  // The category is NOT empty so put smd_gallery tags in here
</txp:smd_if>

I’ve not tested that, but it should work by checking if the {category} is empty and skipping those records. I’ll add some native way of including/excluding uncategorized images on the ToDo list for the next revision. Thanks for spotting the problem!

Last edited by Bloke (2008-08-27 23:52: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

#212 2008-08-30 20:19:57

xzamen
Member
Registered: 2007-02-12
Posts: 18

Re: smd_gallery: super-flexible gallery generator

Bloke, thank you for your suggestion, but actually I found an easy way :)
I just put category=”!asdfg” where asdfg is non-existent category and it does the trick. It displays all images assigned to some cat and skips those without a cat. Great!
But a native way of including/excluding uncategorized images would be very useful!

Offline

#213 2008-08-30 20:59:19

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: smd_gallery: super-flexible gallery generator

xzamen

Neat solution, thanks for sharing. I never even thought of (ab)using the attribute like that; excellent! I’ll certainly look into a way of making it less, umm, hacky in the next rev, though :-)

Last edited by Bloke (2008-08-30 20:59:48)


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

#214 2008-09-01 06:34:56

nardo
Member
From: tuvalahiti
Registered: 2004-04-22
Posts: 741

Re: smd_gallery: super-flexible gallery generator

anyone else get this?

am using custom field named “Showcase” to hold integers … calling that field like so:

<txp:smd_gallery id="?Showcase" form="smd_gallery" />

here is the form:

<a rel="lightbox[{category}]" href="{url}" alt="{alt}"
     title="{title}" >
 <txp:thumbnail id="{id}" />
</a>

there is output on screen… but each thumb is output 3 times! 5 integers, 15 thumbs displayed…

when outputting the images by a category name, behaviour is normal

PS in your first example in the docs there’s a width and height added to the anchor tag; shouldn’t be there right?

Offline

#215 2008-09-01 09:27:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: smd_gallery: super-flexible gallery generator

nardo wrote:

each thumb is output 3 times! 5 integers, 15 thumbs displayed…

Nuts, a confirmed bug. In the process of fixing the problem highlighted by robin746 I broke the code for the situation you mention here. I’ll have to go back and rethink my SQL statement and see if I can come up with some way of fixing it for both scenarios. Thanks for letting me know about this.

In the meantime, if you roll back to v0.44 that should work as you expect. Just make sure you have your images in categories or it’ll not work!

PS in your first example in the docs there’s a width and height added to the anchor tag; shouldn’t be there right?

Correct, I thought I’d fixed that but I must have forgotten. Thanks for pointing it out, I’ll change it.


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

#216 2008-09-03 08:35:12

joel
Member
Registered: 2004-11-26
Posts: 162

Re: smd_gallery: super-flexible gallery generator

Hello,

First of all, thanks for a great plugin (as usual with you Stef).

I have a small problem with wrapping p-tags around the gallery tag.
When I insert this

<txp:smd_gallery category="galleri" sublevel="all" form="gallerier" wraptag="div" />

I get p-tags wrapping the gallery’s div. The reason why I need the div is for clearing the floated thumbnails in case there are content below the thumbs.

Any ideas?

Thanks! :)

Offline

#217 2008-09-03 08:46:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: smd_gallery: super-flexible gallery generator

joel wrote:

I get p-tags wrapping the gallery’s div.

Are you putting the smd_gallery call directly in an article? If so, try adding two space characters before the <txp:smd_gallery... to stop textile from treating the tag as a normal paragraph.


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

#218 2008-09-03 09:09:05

joel
Member
Registered: 2004-11-26
Posts: 162

Re: smd_gallery: super-flexible gallery generator

Thanks! That did the trick!

Offline

#219 2008-09-06 20:29:04

xzamen
Member
Registered: 2007-02-12
Posts: 18

Re: smd_gallery: super-flexible gallery generator

I don’t even know how to put this… Hope you’ll understand.
I’m still trying to make the gallery work as I want it to and the latest idea is to add <txp:category_list type="image"> above the thumbnails to make a sort of image category navigation which is displayed only with a gallery. I tried different variants of <txp:if_...> but none seems to do the intended. Then I thought it would be nice if I could add something in a form, but let it stay out of the “loop”. Something like pageform, let’s say headform. Or maybe there are some other ideas how to do it?

I know I can put my heading in pageform+pagepos and then possition it with CSS, but that gives additional headache.

Offline

#220 2008-09-10 14:30:44

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,672
Website

Re: smd_gallery: super-flexible gallery generator

xzamen wrote:

trying to make … a sort of image category navigation which is displayed only with a gallery.

Sorry for the delay in replying.

That would indeed be very useful. When I first released the plugin it was one of the things it couldn’t handle particularly well; the mighty rloaderro brought this to my attention when using his awesome slideshow script with the plugin because he wanted to output a javascript portion in the <head> tag and the thumbs in the body, all from the same smd_gallery tag.

It would be very very cool to be able to ‘pull out’ some piece(s) of the replacements such that they could be placed anywhere on the page, however I can’t figure a good way of doing it. Combining the collate and regular modes would work (sort of). Setting up a sister tag that allows header/footer stuff was something else I toyed with, and it would work really well on articles. The problem is that it falls apart in an article list context because the header and footer parts would be reprogrammed for each article in the list; that could cause a lot of confusion!

Even the collate mode doesn’t help much in this situation because you don’t know how many categories there are going to be.

The only thing I can suggest right now is two semi-identical smd_gallery calls. The first sets up the menu and lists the category names + links in its container; the second displays the thumbs as normal. Not the most efficient way of doing things but it should work.


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

Board footer

Powered by FluxBB