Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#311 2008-12-24 19:07:00

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

@curiouz,
smd_gallery is not compatible with MLP yet. I’ve read somewhere else that Bloke is working on making it compatible.

@Bloke,

My brain is overheating about how to do the following:
I want the end-user to have an easy way to add just a single txp:tag somewhere on the article body and have an image rendered on that place.
I would also want to give the end-user some basic flexibility to be able to align (float) the image to left or right.
Of course, the candidates to do this task are smd_gallery or upm_image.

What I cannot figure out is how to pass some class value as an attribute and then be able to use it inside the form.
Example:
the end-user inserts just this:

<txp:upm_image id="5" form="captioned-image" class="floatright" />

And then in the form captioned-image:

<div class="{class}">
...
</div>

I would love to do it using upm_image because smd_gallery seems a bit overkilling for displaying just one image.

But probably smd_gallery and its killer combos may be the answer (that come while writing this post):

<txp:smd_gallery id="5" form="captioned-image" combo="class:floatright" />

And then in the form captioned-image:

<div class="{class}">
...
</div>

I have yet to test this, but I’m confident your crazy plug-in is capable of doing this :D

<feed-crazy-ideas-to-the-tiny-alien-whispering-inside-bloke's-brain-before-opening-a-feature-request-to-be-probably-rejected-by-core-devs>

I think txp tags that use a form attribute (or that can act as container tags) could benefit from having this posibilities:

self-awareness (“wtf did he say?”)
So, code inside the called form (or inside the container tags) can access the values of some (all?) attributes and so, then you can do mighty magic using txp:variable and conditionals.

attributes on the fly (and then, the values assigned can be used inside the called form)
The idea is similar (but not really related) to custom field name used as attribute name on txp:article and txp:article_custom.

In other words, txp:tags that can use/be forms/containers should act as a function where arguments can be passed as parameters and so, they can be used inside the form.

BTW, tiny alien inside bloke’s brain, taste this one, did you like it?

</feed-crazy-ideas-to-the-tiny-alien-whispering-inside-bloke's-brain-before-opening-a-feature-request-to-be-probably-rejected-by-core-devs>

Last edited by maniqui (2008-12-24 19:32:48)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#312 2008-12-24 19:25:41

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

Re: smd_gallery: super-flexible gallery generator

great news! thanks maniqui

Offline

#313 2008-12-24 19:39:56

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

maniqui wrote:

I have yet to test this, but I’m confident your crazy plug-in is capable of doing this :D

Worked like a charm.
That combo thing should be a txp standard :D

Edit: I add:

The combo thing is like the attributes-on-the-fly I asked above. It lets you create some kind of dictionary (or keywords arguments) and it opens a whole new world of possibilities.
Mix it with txp:variable and txp:if_variable and the possibilities become a whole new endless universe.

In other words, txp:tags + forms would become almost real functions (I know, they are functions) that let you create your own dictionary of keyword arguments on the fly.

Last edited by maniqui (2008-12-24 19:54:16)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#314 2008-12-26 03:23:12

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Tip: if you are having a hard time on sorting/offsetting/limiting your set of article images in some preferred order, using one (or many) smd_gallery tags and the id="?article_image" attribute/value, don’t forget to use the sort="fixed" attribute/value. Then, the smd_gallery tags will act correctly.

Last edited by maniqui (2008-12-26 03:23:29)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#315 2008-12-26 21:08:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,481
Website

Re: smd_gallery: super-flexible gallery generator

curiouz

Maniqui (thanks) is right : MLP is on its way to this plugin at last. Steve has kindly revamped the way MLP does its query handling to work seamlessly with smd_gallery and it’s rockin’ on all cylinders. I have one outstanding issue to resolve that may (or may not) be because my test environment is in a subdirectory. If I get back affirmation from Steve that it’s simply the subdir causing the pagination problems then I’ll go ahead and release the version I have. It also addresses pretty much everything maniqui raised, i.e. has html_id and escape attributes, date formatting, and so on.

maniqui

Glad you’re finding combos useful :-) They were a result of one of my random “I wonder if…” thought processes, sparked while I was doing some mundane chore like vacuuming the house one day. What’s more exciting in v0.5 of smd_gallery is that — because of MLP support — the plugin will (kind of unfortunately) require smd_lib. But the upside is that txp:variable support becomes native to things like combos. So you won’t even have to use quotes and stuff to insert a <txp:variable name="read_my_var" /> tag as you can just use combo="megaclass:maniqui_?title_?read_my_var" to base the class name on whatever info you care to throw at it. And if you redefine the variable for each image in your gallery, the combo changes likewise.

In addition, if something like my image patch ever gets ratified for core use, you essentially get the essence of upm_image built into the core but in a reduced tag set. smd_lib is already poised to take advantage of this, giving even more flexibility in how you set up galleries.

Tip: if you are having a hard time on sorting/offsetting/limiting your set of article images in some preferred order… don’t forget to use the sort=“fixed” attribute/value

Thanks for clarifying that. It can become confusing because of the way fixed (and random to some degree) work. Certainly random depends on where it is placed in the sort attribute as it behaves differently in different positions. I have tried to explain it in the plugin help but it’s a tough one without some actual examples to back it up.

Bottom line: if you care about the order of stuff and want the plugin to do exactly as you say, not as the database thinks, use sort="fixed" to preserve your ordering.

[ I’m glad someone is getting use out of it, because it was a bitch to write: the database always sorts by something (id, created, name, whatever) so if you want them in a special order the plugin has to pull out all the required images, find the ones you want first, move them and then put all the rest afterwards, taking into account in which position any random attribute occurs. Aaaarghh…! ]


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

Online

#316 2008-12-26 22:18:27

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Hi Bloke, thanks for the detailed reply.

Re: order of images: if you are using values just from ?article_image field, couldn’t the plugin default to the order in which IDs were entered on the article-image field?

Just to clarify: I’m not asking for this feature, but asking if it would make sense. upm_article_image works that way, at least.

BTW, in my particular case, I did have to set the sort="fixed" in two smd_gallery tags because I was also using offset and limit attributes (in different each smd_gallery tags, of course), and without the sort="fixed", the output was making no sense (looked like random output, but not even that, because it always output the same).

Thanks again.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#317 2008-12-26 22:22:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,481
Website

Re: smd_gallery: super-flexible gallery generator

maniqui wrote:

if you are using values just from ?article_image field, couldn’t the plugin default to the order in which IDs were entered on the article-image field?

A compelling proposition; that would make sense, yes. Except you’re not limited to IDs in the article_image field. You may use categories if you wish so I’d have to test that you were using solely IDs and not categories. Or perhaps if you use article_image it does indeed — just for that field — assume a fixed order regardless. But then I’d have to find a way of allowing you to unfix that behaviour if you so desired.

Leave it with me and I’ll think about 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

Online

#318 2008-12-31 07:35:07

quemultimedia
Member
From: Nairobi
Registered: 2008-12-31
Posts: 42
Website

Re: smd_gallery: super-flexible gallery generator

Greetings All,

I’m quite new to textpattern, and I’m still ‘getting a feel’ of textpattern offline. Would like some help with my ‘smd_gallery’ install. I would like to implement a ‘slide-show’ on my homepage, which picks the recent 10 images from the smd_gallery [i.e. image, title, caption e.t.c] and presents [ my inspiration comes from: http://smoothgallery.jondesign.net/ ]. I would like to implement something similar.

Second, I would like to have a section – gallery, which initially lists all sub-galleries [sub-sections], from which, when a sub-gallery is clicked, one can view slide-show of containing images, with a thumbnail list in the <div> that follows the slide-show.

Your input, help, advise will be greatly appreciated. I’m eager to implement this.


Que,
Que-Multimedia

Offline

#319 2008-12-31 11:33:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,481
Website

Re: smd_gallery: super-flexible gallery generator

quemultimedia wrote:

I’m quite new to textpattern, and I’m still ‘getting a feel’ of textpattern offline.

Hello and welcome. Hope you like us all here. I apologise in advance that smd_gallery is a bit of a big step for newcomers and is slightly non-TXP (in its approach) but it’s fairly logical once you get your head round it.

That said, once you’ve downloaded and installed your chosen slideshow system you’ll need to feed the gallery tag to indicate you only want 10 recent images from a particular category:

<txp:smd_gallery category="my_images" limit="10" sort="date desc" />

Then you need to tell the plugin to either pass each image to a nominated form, or do what I’m going to do here and use smd_gallery as a container so each image is processed directly inside the tag:

<txp:smd_gallery category="my_images" limit="10" sort="date desc" wraptag="div" class="myGallery">
<div class="imageElement">
  <h3>{alt}</h3>
  <p>{title}</p>
  <a href="some-section/some-page?pic={url}" title="open image" class="open"></a>
  <img src="{url}" class="full" />
  <img src="{thumburl}" class="thumbnail" />
</div>
</txp:smd_gallery>

All that does is take the format given on the “getting started” page and replaces the relevant bits (the things inside {} markers) with real info from each image. The 3rd line that links to some-page to show a full-size image you would have to design yourself. I chose here to pass a pic paramater with the URL of the image so on that page you could read that variable and fashion some HTML to show the image centre-stage. You can do it however you like; that’s just an example.

Second, I would like to have a section – gallery, which initially lists all sub-galleries [sub-sections]

TXP doesn’t have sub-sections as such, but you can use image categories (or sub-categories) and smd_gallery to achieve the same thing. If you set up one article per gallery and, say, in the article_image field you give it the name of the image category you want to use in that gallery then any time you view that particular article you can use smd_gallery to read the image category and display the corresponding gallery (use category="?article_image")

Furthermore, if you do it that way, to get a “gallery of galleries” you simply need to use the <txp:article /> tag on a section list page (i.e. in your gallery page tempate inside <txp:if_article_list>...</txp:if_article_list> tags) and it will automatically show you all articles (thus galleries) in the section. If you vary your smd_gallery tag in the article list case (perhaps use a different form in the <txp:article /> tag) you can get it to show you one image from the gallery as a thumbnail that — when clicked — will take you to the individual article to see the full gallery.

It’s a little more involved than above, so experiment away with it. If you get stuck, just say.

P.S. on the forum, if you want to show code, use bc. your-code-here. I spotted you trying to use <code> on another thread but this forum uses textile.

Last edited by Bloke (2008-12-31 11:34:11)


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

Online

#320 2008-12-31 15:55:32

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,481
Website

Re: smd_gallery: super-flexible gallery generator

For anyone who missed the post on the slimbox thread, or who only keeps an imaging eye on this thread, Christophe Beyls has just unveiled Slimbox 2. It’s the same animal as before but based on jQuery instead of mootools. For those of you who love the slimbox approach but feel mucky having two js libraries lurking around, this is a great excuse to try it out with smd_gallery!

Thanks again to Christophe for his continuing top notch work.

Last edited by Bloke (2008-12-31 15:56:05)


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

Online

Board footer

Powered by FluxBB