Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-11-24 21:35:11

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Gallery landing page - list of galleries

Hi everyone,

at http://www.judithinglese.com/gallery I’ve created a gallery up using galleria – works fine and dandy:

I now have a need for multiple galleries: so I want to have a landing page for the galleries where they are arranged in a grid with an image and a link to the actual gallery. Like so

I thought I could do this all from a single textpattern page using <txp: if_category>

My idea was to assign a category to the images depending on which gallery they need to go to, and than edit: then (Um um) use <txp:if_category> to determine which gallery (category) is being displayed. So when no category is active (url: http://www.judithinglese.com/gallery), it should display the landing page. I thought I could do this like this: <txp:if_category name=""><ul>...</ul></txp:if_category> But that doesn’t seem to work: nothing appears and the following appears in the tag trace.

<txp:if_category name="">
	[<txp:if_category name="">: false]
</txp:if_category>

So my first question is: how can I have something display if no category is active?

Now for the actual galleries I use <txp:if_category name="gallery1"><txp:output_form form="rendergallery"></txp:if_category>

The form contains the following code:

<div class="demo">
 <div id="main_image"></div>
<txp:output_form form="image_list" />
    <p class="nav"><a href="#" onclick="$.galleria.prev(); return false;">&laquo; previous</a> | <a href="#" 
onclick="$.galleria.next(); return false;">next &raquo;</a></p>
  </div>

The image_list form depends on the wet_for_each_image and upm_image plugins:

<ul class="gallery_demo_unstyled">
  <txp:wet_for_each_image category="<txp:category />">
    <li>
      <txp:upm_image type="image" image_id="{id}"><img src="<txp:upm_img_full_url />"  title="<txp:upm_img_caption />"  
alt="<txp:upm_img_alt />"/></txp:upm_image>
    </li>
  </txp:wet_for_each_image>
</ul>

but if i go to: http://www.judithinglese.dev/gallery?c=gallery (my local development version) (nothing appears apart from:

Tag error:  ->  Textpattern Notice: Page template photoindex2 does not contain a txp:article tag  on line 474
C:\xampp\htdocs\judithinglese.dev\textpattern\publish.php:474 trigger_error()
C:\xampp\htdocs\judithinglese.dev\index.php:40 textpattern()

Does this mean that <txp:if_category> only works for article categories, not for image categories?

Am I a bit thick? Should I approach the problem differently? Can’t believe you read all the way down here. If you have an elegant solution, you may add me to your kidney donor list!

(OK, just kidding, but thanks a lot anyway)

Last edited by JanDW (2008-11-25 20:30:25)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#2 2008-11-24 21:47:56

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Gallery landing page - list of galleries

Its late here and I am not thinking straight, but I have a current project with something similar using 4.07:

Page code:

<txp:if_category>
<div id="large-image">
<txp:wet_for_each_image>
<txp:upm_image form="large_images" image_id="{id}" type="image" />
</txp:wet_for_each_image>
</div>
<txp:else />
<div id="large-image">
<txp:wet_for_each_image category="slideshow">
<txp:upm_image form="large_images" image_id="{id}" type="image" />
</txp:wet_for_each_image>
</div>
</txp:if_category>

Page navigation code

<h2>Image Galleries</h2>
<txp:category_list section="photos" wraptag="ul" break="li" exclude="Article-images,Retired,site-design,slideshow" type="image">
<txp:if_category name='<txp:category />'>&raquo;</txp:if_category>
<txp:category link="1" title="1" />
</txp:category_list>

large_images form

<div>
<img src="<txp:upm_img_full_url />" alt="<txp:upm_img_alt />" />
<txp:if_category>
<h2><txp:category /> gallery</h2>
<p><txp:upm_img_caption /></p>
<txp:else/>
<h2>Slideshow gallery</h2>
<p><txp:upm_img_caption /></p>
</txp:if_category>
</div>

Might be a starting point for you.

Last edited by jstubbs (2008-11-25 07:31:51)

Offline

#3 2008-11-24 21:50:57

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

Re: Gallery landing page - list of galleries

JanDW wrote:

Does this mean that <txp:if_category> only works for article categories, not for image categories?

Sadly, that is correct.

But all is not lost. I’m sure with judicial use of smd_gallery you can achieve this kind of layout. In fact I’ve done landing pages with an entire set of galleries with all the images in different categories from a single smd_gallery tag :-)

If you don’t want to go that way, one way to approach it is to mirror your categories. So you set up identical article and image cats, then you can set up an article per category (i.e. one article per gallery). In other words, create an article, set cat1 to your first category, use an override form (or a <txp:output_form /> tag in that article to call a standard form. That form reads the (article) category1, stuffs it into an smd_gallery tag telling it to get all the images from the identically-named image category and you’re away.

From then on, you can create landing pages via <txp:article listform="my_list" />, individual gallery pages via <txp:article /> and you also gain the benefit of being able to use <txp:if_category /> on the (article) cats, which are automatically echoed through to the form to get the corresponding image cat. You can also use the article_image field to hold the thumbnail id of the image you want to show as the thumb on the landing page.

It’s a bit of a cheat, but it should work… someone might be able to come up with something more elegant, or you could see what smd_gallery can do.

Hope that helps or at least gives you some further devious ideas…

EDIT: haha, or what Jonathan said, which is nicer and far less maintenance :-)

Last edited by Bloke (2008-11-24 21:53:45)


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

#4 2008-11-24 22:40:19

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Gallery landing page - list of galleries

Though you already got two fine answers, here’s one more ;)

So my first question is: how can I have something display if no category is active?

<txp:if_category>
   // here's a (any) category page (you can leave it empty and do nothing)
<txp:else />
   // no category page
</txp:if_category>

Does this mean that <txp:if_category> only works for article categories, not for image categories?

Like Stef, I’ve solved this in the past by creating identical article and image categories.

And very, very OT: every time I see your name, I hear my favourite song ;)

(edited very very stupid mistake. damned song.)

Last edited by els (2008-11-25 16:42:20)

Offline

#5 2008-11-24 23:09:13

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: Gallery landing page - list of galleries

Thanks all three of you, it never seizes to amaze me how the three of you (and a few others) are omnipresent on this forum.
I’ll look into it and see if I actually understand any of your suggestions :-)

And very, very OT: every time I see your name, I hear my favorite song ;)

@Els: Aha! As a kid, every single school teacher brought that up when I introduced myself at the start of the year.
Whether I was a relative? If maybe I could sing that well– as if there is some kind of gene that’s inherited along with the name.
Seems even now that I’m residing in Canada, there is still no escaping it!

Well, I admit: there is no kinship and my singing is rather mediocre at its best. Though I did go to the same school as he did for a while and got thought by a former class mate of his, who of course started to ask me about.… sigh ;-)

Last edited by JanDW (2008-11-25 01:18:58)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#6 2008-11-24 23:09:48

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Gallery landing page - list of galleries

I solved a problem similar to yours with this idea if_category_type , it looks at the category type and may help you here in the case of if_category.

Offline

#7 2008-11-24 23:17:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Gallery landing page - list of galleries

JanDW wrote:

sigh ;-)

I apologize, I could have known I wasn’t the first to bring it up… ;)

Offline

#8 2008-11-25 01:40:13

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: Gallery landing page - list of galleries

rsilletti wrote:

I solved a problem similar to yours with this idea if_category_type , it looks at the category type and may help you here in the case of if_category.

Is there an option to select the category name as well? How could I use this exactly?


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#9 2008-11-25 02:54:04

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Gallery landing page - list of galleries

No, it is not able to filter by category name (At this point I’m thinking it should). I used it to return different content according to the category type being search for, this way:


      <txp:ras_if_category_type type="image">
       Image related content ( nested if_category tags to filter by name? )
      <txp:else />
       Alternate Content if anything but a selected category of type image.
      </txp:ras_if_category_type>

Last edited by rsilletti (2008-11-25 02:57:20)

Offline

#10 2008-11-25 03:01:22

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: Gallery landing page - list of galleries

At this point I’m thinking it should

It would probably make my life a lot easier :-) i’m still not really getting anywhere.

why can’t <txp:if_category> deal with image categories? Or am I gazing into an abyss now?

Well, I think I can’t use it then, as I use multiple image categories that need to be separately accessible. Still, I’ve bookmarked your homepage to have a good look at in the future. Thanks for your help and I’ll expand on my problems…

EDIT

Image related content ( nested if_category tags to filter by name? )

Doesn’t that bring back the problem that if_category can’t deal with image categories?

Last edited by JanDW (2008-11-25 03:04:46)


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#11 2008-11-25 03:07:08

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Gallery landing page - list of galleries

if_category can discriminate categories of any type by name – I believe?

Offline

#12 2008-11-25 03:17:32

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: Gallery landing page - list of galleries

Well, in #3 & #4 Bloke and Els tell me it can’t and I need to mirror them to article categories… but somehow I’m messing that up too….


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

Board footer

Powered by FluxBB