Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#673 2010-04-28 13:22:43

Scott Girvan
Member
Registered: 2010-04-14
Posts: 10

Re: smd_gallery: super-flexible gallery generator

Hmmm, can’t get this to work.

In the gallery section I call an article called VIEW ALL

This is the body of that article:
<txp:smd_gallery category="gallery" sublevel="all" form="gallery" sort="date desc" thumblimit="1" pageform="gallery_nav" />Q

and this is the gallery form:

<a rel="lightbox-{category}" href="{url}" title="{title}"\>{object}</a>

Pageform is exactly what you have in your help files.

I’m dumb. Thank you.

Offline

#674 2010-04-28 15:36:05

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: smd_gallery: super-flexible gallery generator

Hi Scott

Without really studying it but what is that \ backslash doing there? Also the hyphen -{category} after lightbox looks suspicious too.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#675 2010-04-28 16:03:23

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_gallery: super-flexible gallery generator

Scott Girvan wrote:

Hmmm, can’t get this to work.

I think I’ve given you bogus advice then. Perhaps thumblimit simply limits the number of thumbs in each group and doesn’t actually imply any page limit. In fact, I’d bet that’s what it is, sorry for leading you astray. Wish I could remember what all attributes in all my plugins do!

If I come up with any ideas or a fix/new attribute that can help in this regard I’ll shout. Or of course, someone else may figure it out.

I’d probably remove that rogue backslash just for completeness (the -{category} is fine though, colak — it’s pretty standard syntax with lightbox scripts and this plugin).


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

#676 2010-04-28 16:31:24

Scott Girvan
Member
Registered: 2010-04-14
Posts: 10

Re: smd_gallery: super-flexible gallery generator

Thanks, both of you. Yeah that \ is just a type and me not noticing it. If a solution pops up, great. If not I’ll figure some kind of hack. It’s a great (and super easy) gallery plugin. I really like it. It makes me feel all warm and fuzzy.

Offline

#677 2010-05-08 09:23:39

miles
Member
From: Plymouth
Registered: 2008-05-22
Posts: 78
Website

Re: smd_gallery: super-flexible gallery generator

Hi Hope you can help!

Firstly this is one amazing plugin! I use it for all the sites I build! Don’t know what I would do without it!

However I have quite a complex site to build and I am unsure how to setup this gallery that will be very easy for them to update.

Its for a pottery website where they would like all the artists listed in alphabetical order on one page and then you click on someones name which then goes through to the artists personal page showing a description and then 6 images of that artists work.

Now I know I can do this by catagory but that wont be very easy for them to update.

Is there a way maybe the plugin can only show the images matching the alt tag name or the article name?

Or can someone suggest something easier?

Thanks SO much in advance!

Offline

#678 2010-05-10 07:25:19

miles
Member
From: Plymouth
Registered: 2008-05-22
Posts: 78
Website

Re: smd_gallery: super-flexible gallery generator

Dont worry found the best option!

Simly use <txp:smd_gallery id=”?article_image” form=“gallery” />

And put the images in the article images box seperated by commas

Offline

#679 2010-05-11 11:07:57

Hennie
Member
From: Nederland
Registered: 2009-02-06
Posts: 18
Website

Re: smd_gallery: super-flexible gallery generator

Scott, did you already figured out a hack to limit thumbnails to just one per subcategory with sublevel=“all” ?

Offline

#680 2010-05-11 11:58:53

Scott Girvan
Member
Registered: 2010-04-14
Posts: 10

Re: smd_gallery: super-flexible gallery generator

Hi Hennie,
No I haven’t. It would be great to find a solution. My gallery is filling up and I’ll need to paginate it soon.

Offline

#681 2010-05-12 22:35:23

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: smd_gallery: super-flexible gallery generator

Might there be a way to output the file size (in megabytes) of the full size image in the smd_gallery form? I’d like to say: Filesize is {imgfilesize} or something like that under each thumbnail.

Offline

#682 2010-05-12 22:55:03

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_gallery: super-flexible gallery generator

photonomad wrote:

Might there be a way to output the file size (in megabytes) of the full size image in the smd_gallery form?

Sadly, not directly. But you can get it using a snippet of PHP like this:

<txp:smd_gallery category="some-cat">
   <txp:thumbnail id="{id}" />
   <div>Filesize is <txp:php>
         global $img_dir;
         echo round(filesize($img_dir . '/{imagedef}') / 1024 / 1024, 2);
      </txp:php> MB
   </div>
</txp:smd_gallery>

That should grab the file’s size (in Bytes) and convert it to Megabytes for you. The round() functions stops it displaying something silly like 0.002854347229MB.


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

#683 2010-05-14 13:59:59

jmuspratt
Member
From: Nashville, TN
Registered: 2004-10-27
Posts: 54
Website

Re: smd_gallery: super-flexible gallery generator

First off, great plugin Stef. This thing is really amazing.

I’m wondering if it’s possible to use the plugin to hack an extra level of sub-navigation. I’m trying to make a set of artist galleries where each artist is a top-level category and has a number of sub-categories:

Image categories and subcategories:

Joe
> Joe Portfolio 1 
> Joe Portfolio 2
etc.

Mary
> Mary Portfolio 1
> Mary Portfolio 2
etc.

Ted
> Ted Portfolio 1
> Ted Portfolio 2
etc.

To make updating easier, I would really like to link these image categories to TXP articles, not sections.

So I created a section called artists, pointed it at an artists page, posted Joe, Mary, and Ted articles, and they show up fine articles show up at site.com/artists/joe, site.com/artists/mary, etc.

Question 1: Although it’s not explicitly in the documentation, I thought from reading various forum posts that I could link use the article’s url-title to call the same-named categories:

<txp:smd_gallery category="?title" sublevel="all" form="gallery" />

This doesn’t output anything — is it the wrong syntax? (For the time being I’m just making a custom field, called cat-title, with the same text as the url_title (<txp:smd_gallery category="?cat-title" sublevel="all" form="gallery" />) and that outputs the correct images just fine.

Question 2 (the biggie): is there any way to page by category to fake another level of sub-navigation? I’m trying to put Joe’s Portfolio 2 on a different page from his Portfolio 1, but I can’t seem to do that.

Maybe the next best option is to use onchange, wrap each category in a different div, and make javascript-driven tabs instead of actual pages?

Thanks for any thoughts/solutions!

Offline

#684 2010-05-14 15:38:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,269
Website GitHub

Re: smd_gallery: super-flexible gallery generator

jmuspratt wrote:

<txp:smd_gallery category=”?title” sublevel=“all” form=“gallery” />

Very close!

<txp:smd_gallery category="?url_title" sublevel="all" form="gallery" />

(title will get the article’s title — spaces and all).

is there any way to page by category to fake another level of sub-navigation?

Yes, but it might require some trickery (htaccess if you’re comfortable with it) and/or another plugin to make it simpler. Or you can go with a few lines of PHP.

See, the cool thing about TXPs URLs is that anything after the last thingamybob (in your case, the article) is ignored by TXP. But it honours it and passes it along. So all we need to do is make up some fake URLs of the form /section/artist/portfolio_category and then read them in with the aformentioned snip of PHP.

In your article form somewhere you can put this (you can take out all the comments if you like — it’s mostly comments!) :

<txp:php>
global $variable, $thisarticle;

// Read the URL and grab the thing after the last slash.
// This'll either be the author's landing page (their name) OR the name of a portfolio category, so
// set up a txp:variable containing the sub-category. If it doesn't exist, use the author's name later
$variable['chosen_cat'] = array_pop(explode('/', serverset('REQUEST_URI')));

// Set up a txp:variable containing the artist's name (as it appears in the URL)
$variable['theArtist'] = array_pop(explode('/', $thisarticle['url_title']));

if (empty($variable['chosen_cat']) || $variable['chosen_cat'] == $thisarticle['url_title']) {
   // If this is a landing page, limit the thumbnails in each category to just four
   $variable['chosen_cat'] = $variable['theArtist'];
   $variable['thumblim'] = '4';
} else {
   $variable['thumblim'] = '99999';
}
</txp:php>

<txp:hide> Create a navlist of all categories under the current author's image cat </txp:hide>
<txp:category_list type="image" parent='<txp:variable name="theArtist" />' exclude='<txp:variable name="theArtist" />'>
   <a href="<txp:permlink />/<txp:category />"><txp:category /></a>
</txp:category_list>

<txp:hide> The gallery uses the chosen category (which may be the author's name)
    Note that it splits the categories onchange, so if you're on the author's landing
    page, you see a portfolio of all their work from each category.
</txp:hide>
<txp:smd_gallery category="?chosen_cat" sublevel="all" onchange="category_title" onchangewraptag="h3" thumblimt="2">
{onchange:category_title} {object}
</txp:smd_gallery>

Hopefully that’ll do what you want :-) There are probably more elegant solutions out there; perhaps someone else can help in this regard.

Last edited by Bloke (2010-05-14 15:47:55)


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