Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-02-16 23:24:26

itswoody
Member
Registered: 2006-02-16
Posts: 14
Website

if_section name="" not working on article page

Hi all, great forum and great software, wondered if anybody could help me…

I am using the following code to highlight the current section in my site nav:

<code><ul> <li class=“no_link”>Departments</li> <li><a <txp:if_section name=“music”>class=“selected”</txp:if_section> style=“color: #a8e5ee ;” href=”/textpattern/Music/”>Music</a></li> <li><a <txp:if_section name=“film”>class=“selected”</txp:if_section> style=“color: #8CB978 ;” href=”/textpattern/Film/”>Film</a></li> <li><a <txp:if_section name=“downloads”>class=“selected”</txp:if_section> style=“color: #d0ae8a ;” href=”/textpattern/Downloads/”>Downloads</a></li>
</ul></code>

This works great when on a section homepage but when you click on an article on that page and view it the highlight no longer works. Surely because you are viewing an article from a particular section this code should still apply? Is there something I’m doing wrong? Thanks for your help in advance!

Woody

Offline

#2 2006-02-17 01:33:45

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

Re: if_section name="" not working on article page

Odd, that should continue to work, I do this exact thing myself, without problems. Are you sure the form is getting called properly, you don’t have a similar form that’s getting called instead?

Offline

#3 2006-02-17 08:58:11

itswoody
Member
Registered: 2006-02-16
Posts: 14
Website

Re: if_section name="" not working on article page

Well it appears to work fine on a section page like I said but the moment you click to view an article in that section it ceases function! Would it make a difference if I referred to category rather than section?

Offline

#4 2006-02-17 10:06:59

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

Re: if_section name="" not working on article page

Hmm. Really weird. Ok, can you post a tag trace please?

Offline

#5 2006-02-17 18:28:23

itswoody
Member
Registered: 2006-02-16
Posts: 14
Website

Re: if_section name="" not working on article page

<code><!— txp tag trace:
[SQL (0.001107): select name from `txp_lang` where lang=‘en-gb’ limit 1]
[SQL (0.008207): select name, data from `txp_lang` where lang=‘en-gb’ AND ( event=‘public’ OR event=‘common’)]
[SQL (0.007498): select name, code from `txp_plugin` where status=‘1’]
[SQL (0.002058): select title from `txp_section` where name=‘downloads’]
[SQL (0.001744): select ID,Section from `textpattern` where url_title like ‘lime-flower-wallpaper’ AND Section=‘downloads’ limit 1]
[SQL (0.001359): select * from `txp_section` where name = ‘Downloads’ limit 1]
[SQL (0.000806): select Posted, AuthorID, Keywords from `textpattern` where ID=27]
[SQL (0.001216): select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where Posted > ’2006-02-14 23:03:00’ and Section = ‘Downloads’ and Status=4 and Posted < now() order by Posted asc limit 1]
[SQL (0.002042): select ID, Title, url_title, unix_timestamp(Posted) as uposted from textpattern where Posted < ’2006-02-14 23:03:00’ and Section = ‘Downloads’ and Status=4 and Posted < now() order by Posted desc limit 1]
[SQL (0.001494): select RealName from `txp_users` where `name` = ‘itswoody’ limit 1]
[SQL (0.001334): select host from `txp_log` where ip=‘82.32.72.231’ limit 1]
[SQL (0.001295): insert into `txp_log` set `time`=now(),page=’/textpattern/Downloads/lime-flower-wallpaper’,ip=‘82.32.72.231’,host=‘82-32-72-231.cable.ubr02.bath.blueyonder.co.uk’,refer=’‘,status=‘200’,method=‘GET’]
[SQL (0.002131): select user_html from `txp_page` where name=‘downloads’]
[Page: downloads]
<txp:page_title/> [SQL (0.000871): select Title from `textpattern` where ID = 27]
<txp:if_article_list> [<txp:if_article_list>: false]
</txp:if_article_list>
<txp:if_individual_article> [<txp:if_individual_article>: true] <txp:article form=“un1t_view” limit=1 pageby=5 form=“un1t_view” /> [SQL (0.001983): select *, unix_timestamp(Posted) as uPosted from `textpattern` where ID=‘27’ and Status in (4,5) limit 1] [article 27] <txp:file_download_link id=“6”> [SQL (0.005430): select * from `txp_file` where id=‘6’] <txp:file_download_name/> <txp:file_download_size format=“auto” decimals=“2” /> </txp:file_download_link> [SQL (0.001888): select Form from `txp_form` where `name` = ‘un1t_view’ limit 1] [Form: un1t_view] <txp:article_image/> [SQL (0.002775): select * from `txp_image` where id=‘13’] <txp:title/> <txp:body/> <txp:author/> <txp:section link=“y” /> <txp:comments_invite showalways=“1” /> <txp:posted/>
</txp:if_individual_article>
<txp:if_article_list> [<txp:if_article_list>: false]
</txp:if_article_list>
<txp:if_individual_article> [<txp:if_individual_article>: true] <txp:article_custom section=“downloads” limit=1 sortby=“rand()” /> [SQL (0.004427): select *, unix_timestamp(Posted) as uPosted from `textpattern` where 1 and Status=‘4’ and Posted < now() and Section = ‘downloads’ order by rand() desc limit 0, 1] [SQL (0.001486): select Form from `txp_form` where `name` = ‘default’ limit 1] [Form: default] [article 26] <txp:file_download_link id=“5”> [SQL (0.001588): select * from `txp_file` where id=‘5’] <txp:file_download_name/> <txp:file_download_size format=“auto” decimals=“2” /> </txp:file_download_link> <txp:wet_article_thumb/> [SQL (0.001293): select * from `txp_image` where id=‘12’] [SQL (0.001804): select *,ID as thisid, unix_timestamp(Posted) as posted from `textpattern` where ID=26] <txp:permlink> <txp:title/> </txp:permlink> <txp:excerpt/> <txp:permlink> </txp:permlink> <txp:author/> <txp:section link=“y” /> <txp:comments_invite/> <txp:posted/>
</txp:if_individual_article>
<txp:if_article_list> [<txp:if_article_list>: false]
</txp:if_article_list>
<txp:if_individual_article> [<txp:if_individual_article>: true] <txp:article_custom section=“downloads” limit=1 sortby=“rand()” /> [SQL (0.003072): select *, unix_timestamp(Posted) as uPosted from `textpattern` where 1 and Status=‘4’ and Posted < now() and Section = ‘downloads’ order by rand() desc limit 0, 1] [Form: default] [article 25] <txp:file_download_link id=“4”> [SQL (0.001416): select * from `txp_file` where id=‘4’] <txp:file_download_name/> <txp:file_download_size format=“auto” decimals=“2” /> </txp:file_download_link> <txp:wet_article_thumb/> [SQL (0.001176): select * from `txp_image` where id=‘11’] [SQL (0.001978): select *,ID as thisid, unix_timestamp(Posted) as posted from `textpattern` where ID=25] <txp:permlink> <txp:title/> </txp:permlink> <txp:excerpt/> <txp:permlink> </txp:permlink> <txp:author/> <txp:section link=“y” /> <txp:comments_invite/> <txp:posted/>
</txp:if_individual_article>
<txp:if_article_list> [<txp:if_article_list>: false]
</txp:if_article_list>
<txp:if_individual_article> [<txp:if_individual_article>: true] <txp:article_custom section=“downloads” limit=1 sortby=“rand()” /> [SQL (0.002940): select *, unix_timestamp(Posted) as uPosted from `textpattern` where 1 and Status=‘4’ and Posted < now() and Section = ‘downloads’ order by rand() desc limit 0, 1] [Form: default] [article 24] <txp:file_download_link id=“3”> [SQL (0.001198): select * from `txp_file` where id=‘3’] <txp:file_download_name/> <txp:file_download_size format=“auto” decimals=“2” /> </txp:file_download_link> <txp:wet_article_thumb/> [SQL (0.002378): select * from `txp_image` where id=‘10’] [SQL (0.001905): select *,ID as thisid, unix_timestamp(Posted) as posted from `textpattern` where ID=24] <txp:permlink> <txp:title/> </txp:permlink> <txp:excerpt/> <txp:permlink> </txp:permlink> <txp:author/> <txp:section link=“y” /> <txp:comments_invite/> <txp:posted/>
</txp:if_individual_article>
<txp:if_article_list> [<txp:if_article_list>: false]
</txp:if_article_list>
<txp:if_individual_article> [<txp:if_individual_article>: true] <txp:article_custom section=“downloads” limit=1 sortby=“rand()” /> [SQL (0.002982): select *, unix_timestamp(Posted) as uPosted from `textpattern` where 1 and Status=‘4’ and Posted < now() and Section = ‘downloads’ order by rand() desc limit 0, 1] [Form: default] [article 24] <txp:file_download_link id=“3”> [SQL (0.001011): select * from `txp_file` where id=‘3’] <txp:file_download_name/> <txp:file_download_size format=“auto” decimals=“2” /> </txp:file_download_link> <txp:wet_article_thumb/> [SQL (0.001188): select * from `txp_image` where id=‘10’] [SQL (0.001972): select *,ID as thisid, unix_timestamp(Posted) as posted from `textpattern` where ID=24] <txp:permlink> <txp:title/> </txp:permlink> <txp:excerpt/> <txp:permlink> </txp:permlink> <txp:author/> <txp:section link=“y” /> <txp:comments_invite/> <txp:posted/>
</txp:if_individual_article>
<txp:if_section name=“music”> [<txp:if_section name=“music”>: false]
</txp:if_section>
<txp:if_section name=“film”> [<txp:if_section name=“film”>: false]
</txp:if_section>
<txp:if_section name=“downloads”> [<txp:if_section name=“downloads”>: false]
</txp:if_section>
<txp:if_section name=“minimicros”> [<txp:if_section name=“minimicros”>: false]
</txp:if_section>
<txp:if_section name=“un1t” > [<txp:if_section name=“un1t” >: false]
</txp:if_section>
<txp:output_form form=“stats” /> [SQL (0.001540): select form from `txp_form` where `name` = ‘stats’ limit 1]
[ —- secondpass —- ] —></code>

Offline

#6 2006-02-17 18:30:17

itswoody
Member
Registered: 2006-02-16
Posts: 14
Website

Re: if_section name="" not working on article page

Sorry it’s such a long post? Any ideas? Could be related to the use of capital letters in the section name?

Offline

#7 2006-02-17 18:36:16

itswoody
Member
Registered: 2006-02-16
Posts: 14
Website

Re: if_section name="" not working on article page

Wow I’ve fixed it! Turns out it was caused by capitalisation in the section name! Thanks for you help…

Offline

#8 2006-02-18 03:43:17

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

Re: if_section name="" not working on article page

Thanks for getting back to us. :)

Offline

Board footer

Powered by FluxBB