Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-06-18 03:26:08
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Attributes not parsed in category tag when used in an image_index tag
The following code should work, but the category tag returns nothing if either the title or link attribute is included. It works well if no attributes are used. I have read the guideline articles on the weblog (which are very clear) and it strikes me that I should be able to use this as is. Am I not using this right? ( Textpattern version: 4.0.6 (r2899) )
[edit] Ok? article is the default category type, unless you explicitly declare the type in the tag that follows it returns nothing (works fine if you do however, so my problem is solved). Seems to have to do with this line of code at line 2072:
$label = htmlspecialchars( ($title) ? fetch_category_title($category, $type) : $category );
Not sure if this behavior is as intended?
<txp:image_index c='<txp:category />' class="content" label='Category: <txp:category title="1" />' labeltag="h4" />
Last edited by rsilletti (2008-06-19 03:17:05)
Offline
Re: Attributes not parsed in category tag when used in an image_index tag
Tag trace please.
Offline
#3 2008-06-19 00:03:51
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Attributes not parsed in category tag when used in an image_index tag
<!-- Runtime: 0.0309 -->
<!-- Query time: 0.008535 -->
<!-- Queries: 21 -->
<!-- Memory: 2212Kb, <txp:image_display /> -->
<!-- txp tag trace:
[SQL (0.0015730857849121): select name, data from matttxp_lang as txp_lang where lang='en-gb' AND ( event='public' OR event='common')]
[SQL (0.00043487548828125): select name, code, version from matttxp_plugin as txp_plugin where status = 1 order by `order`]
[SQL (0.00012111663818359): select name from matttxp_section as txp_section where `name` like 'photos' limit 1]
[SQL (0.0014321804046631): select page, css from matttxp_section as txp_section where name = 'photos' limit 1]
[SQL (0.00050902366638184): select host from matttxp_log as txp_log where ip='4.228.141.9' limit 1]
[SQL (0.00049901008605957): insert into matttxp_log set `time`=now(),page='/matt/photos/?c=landscape',ip='4.228.141.9',host='4.228.141.9',refer='',status='200',method='GET']
[SQL (0.00015997886657715): select user_html from matttxp_page as txp_page where name='photos']
[Page: photos]
<txp:page_title />
[SQL (0.0001070499420166): select title from matttxp_category as txp_category where name='landscape' and type='article']
<txp:site_url />
<txp:feed_link flavor="atom" format="link" label="Atom" />
<txp:feed_link flavor="rss" format="link" label="RSS" />
<txp:rvm_css format="link" />
[SQL (0.0001068115234375): select css from matttxp_section as txp_section where name='photos']
<txp:rsd />
<txp:if_section name="default">
[<txp:if_section name="default">: false]
<txp:section />
</txp:if_section>
<txp:text item="go_content" />
<txp:text item="go_nav" />
<txp:text item="go_search" />
<txp:link_to_home>
<txp:site_name />
</txp:link_to_home>
<txp:site_slogan />
<txp:article pgonly="1" limit="5" />
[SQL (0.00041508674621582): select count(*) from matttextpattern as textpattern where 1=1 and Status = 4 and Posted <= now() and (Category1 IN ('landscape') or Category2 IN ('landscape')) and Section IN ('photos')]
<txp:section_list default_title='<txp:text item="home" />' include_default="0" wraptag="ul" break="li" label="Articles by Section" labeltag="h4">
[attribute 'default_title']
<txp:text item="home" />
[/attribute]
[SQL (0.00014495849609375): select name, title from matttxp_section as txp_section where name != 'default' order by name ASC]
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:section link="1" title="1" />
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:section link="1" title="1" />
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:section link="1" title="1" />
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: false]
</txp:if_section>
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: true]
</txp:if_section>
<txp:section link="1" title="1" />
<txp:if_section name='<txp:section />'>
[attribute 'name']
<txp:section />
[/attribute]
[<txp:if_section name='<txp:section />'>: true]
<txp:article_custom section='<txp:section />' wraptag="p" break="br">
[attribute 'section']
<txp:section />
[/attribute]
[SQL (0.00061202049255371): select *, unix_timestamp(Posted) as uPosted from matttextpattern as textpattern where 1=1 and Status = 4 and Posted <= now() and Section IN ('photos') order by Posted desc limit 0, 10]
</txp:article_custom>
</txp:if_section>
</txp:section_list>
<txp:search_input wraptag="h4" />
[SQL (0.00012612342834473): select form from matttxp_form where `name` = 'search_input' limit 1]
<txp:feed_link label="RSS" />
<txp:feed_link flavor="atom" label="Atom" />
<txp:category_list type="link" wraptag="ul" break="li" label="Links by Category" labeltag="h4">
[SQL (0.00012588500976562): select name, title from matttxp_category as txp_category where type = 'link' and name not in('default','root') order by name ASC]
<txp:if_category name='<txp:category />'>
[attribute 'name']
<txp:category />
[/attribute]
[<txp:if_category name='<txp:category />'>: false]
</txp:if_category>
<txp:category link="1" title="1" />
<txp:if_category name='<txp:category />'>
[attribute 'name']
<txp:category />
[/attribute]
[<txp:if_category name='<txp:category />'>: false]
</txp:if_category>
<txp:category link="1" title="1" />
<txp:if_category name='<txp:category />'>
[attribute 'name']
<txp:category />
[/attribute]
[<txp:if_category name='<txp:category />'>: false]
</txp:if_category>
<txp:category link="1" title="1" />
</txp:category_list>
<txp:category_list type="image" wraptag="ul" break="li" label="Gallery by Category" labeltag="h4" parent="Gallery">
[SQL (0.00012302398681641): select lft, rgt from matttxp_category as txp_category where type = 'image' and name = 'Gallery']
[SQL (0.00011587142944336): select name, title from matttxp_category as txp_category where (lft between 2 and 7) and type = 'image' and name != 'default' order by lft ASC]
<txp:if_category name='<txp:category />'>
[attribute 'name']
<txp:category />
[/attribute]
[<txp:if_category name='<txp:category />'>: false]
</txp:if_category>
<txp:category link="1" title="1" type="image" />
<txp:if_category name='<txp:category />'>
[attribute 'name']
<txp:category />
[/attribute]
[<txp:if_category name='<txp:category />'>: true]
</txp:if_category>
<txp:category link="1" title="1" type="image" />
<txp:if_category name='<txp:category />'>
[attribute 'name']
<txp:category />
[/attribute]
[<txp:if_category name='<txp:category />'>: false]
</txp:if_category>
<txp:category link="1" title="1" type="image" />
</txp:category_list>
<txp:site_url />
<txp:ras_if_category_type type="image">
[SQL (0.00014400482177734): select * from matttxp_category as txp_category where name='landscape' and type='image']
[<txp:ras_if_category_type type="image">: true]
<txp:image_index c='<txp:category />' class="content" label='<txp:category title="1" />' labeltag="h4" />
[attribute 'c']
<txp:category />
[/attribute]
[attribute 'label']
<txp:category title="1" />
[/attribute]
[SQL (0.00020694732666016): select * from matttxp_image as txp_image where category = 'landscape' and thumbnail = 1 order by name ASC ]
<txp:image_display />
</txp:ras_if_category_type>
<txp:ras_if_category_type type="link">
[SQL (0.00015497207641602): select * from matttxp_category as txp_category where name='landscape' and type='link']
[<txp:ras_if_category_type type="link">: false]
</txp:ras_if_category_type>
<txp:output_form form="footer" />
[SQL (0.00012516975402832): select Form from matttxp_form as txp_form where name='footer']
[Form: footer]
[ ~~~ secondpass ~~~ ]
-->
Offline
#4 2008-06-19 03:13:11
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Attributes not parsed in category tag when used in an image_index tag
fetch_category_title does use a default of “article” for the type attribute and passes this to the query if nothing else is defined, the query then finds no match from amongst the image categories and returns nothing. Its anded by name and type.
Last edited by rsilletti (2008-06-19 03:14:09)
Offline
Re: Attributes not parsed in category tag when used in an image_index tag
Ah, that’s correct behaviour. Everything assumes type=article by default. Since the same category name can exist both as image and as article category, there’s no way to distinguish between the two except when you explicitly specify it.
Last edited by ruud (2008-06-19 06:23:55)
Offline
#6 2008-06-19 08:12:49
- rsilletti
- Moderator
- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: Attributes not parsed in category tag when used in an image_index tag
Yes, makes sense – thanks.
Offline