Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2011-01-23 20:51:06

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

Re: category_list not setting active_class

bici wrote:

How do i do “tag trace”?

See the link in my signature :)

Offline

#14 2011-01-23 21:03:18

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: category_list not setting active_class

right :0

I get this output:

<txp:section_list wraptag="ul" break="li" active_class="active" sections=", products, about, history, wholesale, contact" />
		[SQL (0.000229120254517): select name, title from txp_section where name in ('','products','about','history','wholesale','contact') order by field(name, '','products','about','history','wholesale','contact')]
<txp:category_list parent="products" exclude="products" children="0" wraptag="ul" break="">
	[SQL (0.000152826309204): select lft, rgt from txp_category where type = 'article' and name = 'products']
	[SQL (0.00025200843811): select name, title from txp_category where (lft between 6 and 21) and type = 'article' and name != 'default' and name not in('products') and (parent = 'products' or name = 'products') 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 title="1" link="1" />
	<txp:if_category name='<txp:category />'>
		[attribute 'name']
		<txp:category />
		[/attribute]
		[<txp:if_category name='<txp:category />'>: false]

(added bc. for better display. -Els)

Last edited by els (2011-01-23 21:04:35)


…. texted postive

Offline

#15 2011-01-23 21:05:28

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

Re: category_list not setting active_class

And what is the URL of the page in question? Is it a category page?

Offline

#16 2011-01-23 21:10:31

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: category_list not setting active_class

if i go to one of the category links in the section in question ( Products) i get this URL -
http://example.dev/index.php?s=products&c=tiger-brand

All categories are listed. I then click on Tiger Brand category and it displays the correct article content associated with that category. but no active class.


…. texted postive

Offline

#17 2011-01-23 21:12:46

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

Re: category_list not setting active_class

Hmm… I don’t see anything wrong with your code. Would you mind posting the entire tag trace? (just to see if there is anything else conflicting?)

Offline

#18 2011-01-23 21:20:07

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: category_list not setting active_class

@<!-- txp tag trace: 
[SQL (0.00211596488953): select name, data from txp_lang where lang='en-us' AND ( event='public' OR event='common')]
[SQL (0.000278949737549): select name, code, version from txp_plugin where status = 1 AND type IN (0,1) order by load_order]
[SQL (0.0001540184021): select page, css from txp_section where name = 'products' limit 1]
[SQL (0.000198125839233): select host from txp_log where ip='127.0.0.1' limit 1]
[SQL (0.00019907951355): insert into txp_log set `time`=now(),page='/index.php?s=products&c=tiger-brand',ip='127.0.0.1',host='example.dev',refer='',status='200',method='GET']
[SQL (0.000137805938721): select user_html from txp_page where name='store_page']
[Page: store_page]
<txp:output_form form="meta" />
	[SQL (0.000138998031616): select Form from txp_form where name='meta']
	[Form: meta]
	<txp:page_title />
		[SQL (0.000150918960571): select title from txp_category where name='tiger-brand' and type='']
<txp:output_form form="lightbox" />
	[SQL (0.0001380443573): select Form from txp_form where name='lightbox']
	[Form: lightbox]
<txp:output_form form="header+nava" />
	[SQL (0.000126123428345): select Form from txp_form where name='header+nava']
	[Form: header+nava]
	<txp:section_list wraptag="ul" break="li" active_class="active" sections=", products, about, history, wholesale, contact" />
		[SQL (0.000231981277466): select name, title from txp_section where name in ('','products','about','history','wholesale','contact') order by field(name, '','products','about','history','wholesale','contact')]
<txp:category_list parent="products" exclude="products" children="0" wraptag="ul" break="">
	[SQL (0.000153064727783): select lft, rgt from txp_category where type = 'article' and name = 'products']
	[SQL (0.000250101089478): select name, title from txp_category where (lft between 6 and 21) and type = 'article' and name != 'default' and name not in('products') and (parent = 'products' or name = 'products') 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 title="1" link="1" />
	<txp:if_category name='<txp:category />'>
		[attribute 'name']
		<txp:category />
		[/attribute]
		[<txp:if_category name='<txp:category />'>: false]
	</txp:if_category>
	<txp:category title="1" link="1" />
	<txp:if_category name='<txp:category />'>
		[attribute 'name']
		<txp:category />
		[/attribute]
		[<txp:if_category name='<txp:category />'>: false]
	</txp:if_category>
	<txp:category title="1" link="1" />
	<txp:if_category name='<txp:category />'>
		[attribute 'name']
		<txp:category />
		[/attribute]
		[<txp:if_category name='<txp:category />'>: false]
	</txp:if_category>
	<txp:category title="1" link="1" />
	<txp:if_category name='<txp:category />'>
		[attribute 'name']
		<txp:category />
		[/attribute]
		[<txp:if_category name='<txp:category />'>: false]
	</txp:if_category>
	<txp:category title="1" link="1" />
	<txp:if_category name='<txp:category />'>
		[attribute 'name']
		<txp:category />
		[/attribute]
		[<txp:if_category name='<txp:category />'>: false]
	</txp:if_category>
	<txp:category title="1" link="1" />
	<txp:if_category name='<txp:category />'>
		[attribute 'name']
		<txp:category />
		[/attribute]
		[<txp:if_category name='<txp:category />'>: false]
	</txp:if_category>
	<txp:category title="1" link="1" />
</txp:category_list>
<txp:article form="static_text" limit="1"/>
	[SQL (0.000298023223877): select count(*) from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('tiger-brand') or Category2 IN ('tiger-brand')) and Section IN ('products')]
	[SQL (0.000366926193237): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and (now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('tiger-brand') or Category2 IN ('tiger-brand')) and Section IN ('products') order by Posted desc limit 0, 1]
	[article 5]
	[SQL (0.000138998031616): select Form from txp_form where name='static_text']
	[Form: static_text]
	<txp:title />
	<txp:body />
<txp:output_form form="footer" />
	[SQL (0.000128984451294): select Form from txp_form where name='footer']
	[Form: footer]
[ ~~~ secondpass ~~~ ]@

Last edited by bici (2011-01-23 21:21:05)


…. texted postive

Offline

#19 2011-01-23 21:35:41

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

Re: category_list not setting active_class

The only thing I can think of is that it’s related to this problem. Does it work if you change your code to:

<ul id="subnav_products">  
   <txp:variable name="cat" value='<txp:page_url type="c" />' />
   <txp:category_list parent="products" exclude="products" children="0" wraptag="ul" break="">
	<li<txp:if_variable name="cat" value='<txp:category />'> class="active"</txp:if_variable>><txp:category title="1" link="1" /></li>
   </txp:category_list> 
</ul>

Offline

#20 2011-01-23 21:44:57

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: category_list not setting active_class

It might be that. your solution makes all the sub-links the active colour, but it does include the active class!

pre.
<ul id=“subnav_products”>

<ul class=“category_list”> <li><a href=“http://example.dev/index.php?s=products&amp;c=sagra-olive-oil”>Sagra Olive Oil</a></li>

<li class=“active”><a href=“http://example.dev/index.php?s=products&amp;c=tiger-brand”>Tiger Brand</a></li>.

Last edited by bici (2011-01-23 21:45:26)


…. texted postive

Offline

#21 2011-01-23 21:56:24

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

Re: category_list not setting active_class

bici wrote:

your solution makes all the sub-links the active colour

I think that’s because of your css: you have li a.active, change it to li.active.

Last edited by els (2011-01-23 22:00:40)

Offline

#22 2011-01-23 22:07:19

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: category_list not setting active_class

Els wrote:

bici wrote:
your solution makes all the sub-links the active colour

I think that’s because of your css: you have li a.active, change it to li.active.

lovely!

Many thanks


…. texted postive

Offline

#23 2011-01-23 22:09:07

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

Re: category_list not setting active_class

Glad we found it! But are you using gbp_permanent_links, or maybe another plugin that might be causing if_category not to work?

Offline

#24 2011-01-23 22:13:20

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,092
Website Mastodon

Re: category_list not setting active_class

i have this active plugin: cbs_navigation_menu

and this one inactive: esq_ifcategory


…. texted postive

Offline

Board footer

Powered by FluxBB