Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#211 2008-08-27 23:51:57
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.
Hire 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
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.
Hire 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: 743
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
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.
Hire 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
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.
Hire 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
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.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#221 2008-09-12 13:06:36
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: smd_gallery: super-flexible gallery generator
Bloke:
Hope all is well.
I have run into a niggle that I hope you can assit me with. I am using smd_gallery with slimbox on my recent project. I have everything set up properly and it functions like a charm :) BUT and isn’t their always a but ….
… to get it work, here is the key part of the <head> info ….
<txp:smd_slimbox_inc jsdir="/js" cssdir="/css" />
<script type="text/javascript" src="http://www. ... .com/js/menu.js"></script>
<script type="text/javascript" src="http://www. ... .com/textpattern/jquery.js"></script>
<script type="text/javascript" src="http://www. ... .com/js/mootools.js"></script>
<script type="text/javascript" src="http://www. ... .com/js/slimbox.js"></script>
<link rel="stylesheet" href="http://www. ... .com/css/slimbox.css" type="text/css" media="screen" />
My problem is that when it displays the light box effect you still see the menu … to add one more wrinkle to the picture … the problem only appears in Firefox and not in IE (at least not in IE 7)
Finally, if I move the the lightbox code up in the <head> section then it does not work.
I am hoping you or others have see this happen and know a solution …
As usual, any and all assistance is greatly appreciated.
progre55
Last edited by progre55 (2008-09-12 13:07:04)
Offline
#222 2008-09-12 13:30:00
Re: smd_gallery: super-flexible gallery generator
progre55 wrote:
when it displays the light box effect you still see the menu
Without knowing what menu.js does, it’s difficult to say why it might be doing this. Mucking about with the library load order isn’t generally a good idea; although menu.js can go last, make sure any 3rd party js library is loaded before slimbox.js and its css.
Is there a clash between mootools and jQuery? Do you get any js errors in Firebug?
P.S. you don’t need smd_slimbox_inc any more… especially not with smd_gallery :-)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#223 2008-09-12 14:04:24
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: smd_gallery: super-flexible gallery generator
Bloke:
I do not get any error messages :)
If I try to use the work arounds from the page you reference, I can not get anything to load on the page … it is completely blank …
Also, I removed the unnecessary line you mentioned … thanks …
progre55
Last edited by progre55 (2008-09-12 14:05:06)
Offline
#224 2008-09-14 13:02:54
- xzamen
- Member
- Registered: 2007-02-12
- Posts: 18
Re: smd_gallery: super-flexible gallery generator
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.
Bloke, thank you for that solution.
I have another question. Is it possible to substitute anything? Let’s say I have categories cat-1, cat-2, cat-z etc and I want them all to be displayed so I would put something like category=“cat-?*” Sort of regular expressions or something?
Offline
#225 2008-09-14 15:34:34
Re: smd_gallery: super-flexible gallery generator
progre55
Do you have a site link you can e-mail me? I can’t think of anything else off the top of my head without seeing the site in question or a bit more detail of either the HTML source code and/or this menu.js thing (is it a third party tool? If so, where did you get it?)
xzamen
Is it possible to substitute anything?
Currently no :-( Regexes did cross my mind but they cause all sorts of problems because of my ‘?’ and ‘!’ syntax already employed by the plugin. Plus, they’re a pig to write/support!
As a workaround, if you have a recent dev branch of TXP lying around you can quickly nest all your cat-1, cat-2, cat-z links in one fell swoop under a parent category. (Under TXP 4.0.6 and below you have to nest them one at a time, which might become tedious depending on how many you have). Then just use category="my-new-parent-cat" sublevel="all" in the plugin.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline