Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-19 09:49:36

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

Display image categories

Run into a mind block here. I have a section called “photos”, in which I want to display 3 image category links on the sidebar – work, travel, personal.

I use the category_list tag: category_list active_class=“active” break=“li” class=“list_images” type=“image” wraptag=“ul”

When in the photos section, clicking on “work” for example, should bring up all the thumbnails of images in the work image category.

Thing is, categories use the front page by default, so at the moment, clicking on work brings us to a nice blank page, instead of the images.

Can’t seem to get my mind around this simple problem today, can someone point me in the right direction?

Offline

#2 2007-08-19 09:55:18

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

Re: Display image categories

Doh!! Changed the tag to assign the photos section, and it works:

category_list active_class=“active” break=“li” class=“list_images” section=“photos” type=“image” wraptag=“ul”

Offline

#3 2007-08-19 11:24:07

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

Re: Display image categories

OK another question:

I have this tag in a form which is outputted to my “photos” page:
category_list class=“list_images” active_class=“active” break=“li” section=“photos” type=“image” wraptag=“ul”

The active_class is not applied on the link when using this tag on a section page, like so:

mysite.com/photos/?c=Work

But the active_class IS applied when using the default page, like so:

mysite.com/category/Design/

Any idea why? Apart from the fact that the “type” is “image” in the tag, there is no difference, apart from the URL. Is the active_class only applied on /category/ pages using the default page?

Offline

#4 2007-08-20 21:45:48

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Display image categories

Is the active_class only applied…?

No, it shouldn’t. Does a tag trace reveal anything?

Offline

#5 2007-08-21 18:07:22

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

Re: Display image categories

Hi Mary,

Set site to debugging, and the following shows up at the top of the page:

Tag error: -> Textpattern Notice: Page template archive does not contain a txp:article tag on line 464
textpattern/publish.php:464 trigger_error()
index.php:39 textpattern()

The code in the page is the following:

<txp:if_section name=“photos”>
<txp:if_category>
<txp:article_custom section=“photos” />
<txp:output_form form=“images” />
<txp:else />
<txp:article limit=1 />
</txp:if_category>
</txp:if_section>

So, there IS an article tag in there…

The tag trace is below:

<!— Runtime: 0.1304 —>
<!— Query time: 0.009685 —>
<!— Queries: 20 —>
<!— Memory: 3623Kb, <txp:upm_image type=“popup” image_id=“42”/> —>
<!— txp tag trace:
[SQL (0.000121): select name from txp_lang where lang=‘en-gb’ limit 1]
[SQL (0.001952): select name, data from txp_lang where lang=‘en-gb’ AND ( event=‘public’ OR event=‘common’)]
[SQL (0.002756): select name, code, version from txp_plugin where status = 1]
[SQL (0.000389): select name from txp_section where `name` like ‘photos’ limit 1]
[SQL (0.000138): select * from txp_section where name = ‘photos’ limit 1]
[SQL (0.000314): select user_html from txp_page where name=‘archive’]
[Page: archive]
<txp:output_form form=“header” /> [SQL (0.000145): select Form from txp_form where name=‘header’] [Form: header] <txp:css/> <txp:page_title/> [SQL (0.000092): select title from txp_category where name=‘Work’ and type=‘article’]
<txp:output_form form=“logo_and_menu” /> [SQL (0.000093): select Form from txp_form where name=‘logo_and_menu’] [Form: logo_and_menu] <txp:link_to_home> </txp:link_to_home> <txp:section_list active_class=“active” sections=“Photos,Shop,About,Contact” exclude=“search” include_default=“1” default_title=“Blog” wraptag=“ul” break=“li” /> [SQL (0.000733): select name, title from txp_section where name in (‘Photos’,‘Shop’,‘About’,‘Contact’) order by field(name, ‘Photos’,‘Shop’,‘About’,‘Contact’)]
<txp:if_section name=“photos”> [<txp:if_section name=“photos”>: true] <txp:output_form form=“image_categories” /> [SQL (0.000110): select Form from txp_form where name=‘image_categories’] [Form: image_categories] <txp:category_list class=“sidelink” active_class=“active” break=“li” section=“photos” type=“image” wraptag=“ul” /> [SQL (0.000114): select name, title from txp_category where type = ‘image’ and name not in(‘default’,‘root’) order by name ASC]
</txp:if_section>
<txp:if_section name=“contact”> [<txp:if_section name=“contact”>: false]
</txp:if_section>
<txp:if_section name=“photos”> [<txp:if_section name=“photos”>: true] <txp:if_category> [<txp:if_category>: true] <txp:article_custom section=“photos” /> [SQL (0.000956): select *, unix_timestamp(Posted) as uPosted from textpattern where 1 and Status = 4 and Posted <= now() and Section = ‘photos’ order by Posted desc limit 0, 10] [article 18] [SQL (0.000099): select Form from txp_form where name=‘default’] [Form: default] <txp:title/> <txp:body/> <txp:article_image/> <txp:comments_invite/> <txp:output_form form=“images” /> [SQL (0.000099): select Form from txp_form where name=‘images’] [Form: images] <txp:if_category name=“Work”> [<txp:if_category name=“Work”>: true] <txp:wet_for_each_image category=“Work”> [SQL (0.000135): select id from txp_image where 1=1 and category in (‘Work’)] <txp:upm_image type=“popup” image_id=“41”/> [SQL (0.000148): select * from txp_image where id = ‘41’ limit 0, 1] <txp:upm_image type=“popup” image_id=“42”/> [SQL (0.000477): select * from txp_image where id = ‘42’ limit 0, 1] </txp:wet_for_each_image> </txp:if_category> <txp:if_category name=“Personal”> [<txp:if_category name=“Personal”>: false] </txp:if_category> <txp:if_category name=“Travel”> [<txp:if_category name=“Travel”>: false] </txp:if_category> </txp:if_category>
</txp:if_section>
<txp:if_section name=“shop”> [<txp:if_section name=“shop”>: false]
</txp:if_section>
<txp:if_section name=“about”> [<txp:if_section name=“about”>: false]
</txp:if_section>
<txp:output_form form=“footer” /> [SQL (0.000116): select Form from txp_form where name=‘footer’] [Form: footer]
[ ~~~ secondpass ~~~ ]

Offline

#6 2007-08-21 18:09:56

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Display image categories

jstubbs wrote:

The active_class is not applied on the link when using this tag on a section page, like so:

mysite.com/photos/?c=Work

But the active_class IS applied when using the default page, like so:

mysite.com/category/Design/

This should already be fixed in SVN. It’s the uppercase category name that is causing problems (if you change the category name to lowercase, while keeping the category title uppercase, it’ll work).

Last edited by ruud (2007-08-21 18:10:55)

Offline

#7 2007-08-29 17:15:07

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

Re: Display image categories

Oh thanks Ruud, I missed your reply in the last couple of days…it works now ;-)

Offline

Board footer

Powered by FluxBB