Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-02-27 21:21:51

camcgee
New Member
Registered: 2008-02-27
Posts: 1

any way to add id element to section_list?

I have searched the forums for an answer to this but can’t find anything.

Is there any way to automatically generate a unique id element for the <txp:section_list />, perhaps through some plugin. Nothing in the basic tags seems to do what I want.

The end result I’m looking for is that each section link will have a unique identifier so that I can apply specific styling (i.e., image replacement) to links individually: <li id="about"><a href="index.php?s=about">About</a></li>

The other option would be manually coding the links, which I can do but I was hoping there would be some way to automatically call the section title from the database.

Thanks for your help.

Offline

#2 2008-02-27 22:12:57

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

Re: any way to add id element to section_list?

Page:

<txp:article_custom form="alt_section_list" sort="section asc" />

Article form ‘alt_section_list’:

<txp:if_first_article><ul></txp:if_first_article>
<txp:if_different>
<li id="<txp:section />"><txp:section title="1" link="1" /></li>
</txp:if_different>
<txp:if_last_article></ul></txp:if_last_article>

The downside is that you can only sort the list alphabetically, either asc or desc. And it will only show sections that have articles.

Last edited by els (2008-02-27 22:14:31)

Offline

#3 2008-02-27 22:22:03

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: any way to add id element to section_list?

It would be quite easy do with a plugin (or mod), if you were willing to have the id in the a element instead of the li, because then it should only take a small change to the section_list function (see taghandlers.php).


Code is topiary

Offline

Board footer

Powered by FluxBB