Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-20 22:09:26

Joey
Member
From: Netherlands
Registered: 2005-01-19
Posts: 257

Give links a unique ID

Is there a possibility (plugin) to give each link a unique id? I want to manage my navigation within the “links” tab, however I need txp:linklist to export a unique id for each link (of course, I will define the id’s myself). Someting like:

<ul id="nav">
<li><a href="#" id="nav-home">Home</a></li>
<li><a href="#" id="nav-contact">Contact</a></li>
</ul>

Regards,

Joey

Offline

#2 2008-06-20 22:20:13

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

Re: Give links a unique ID

If you’re using links for your navigation, maybe you are not using the description field at the moment? So you could do something like this:

<a href="<txp:link_url />" class="<txp:link_description />">Home</a>

(You can use the category field in the same way.)

Offline

#3 2008-06-20 22:24:03

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Give links a unique ID

It looks like you want a section list. With 4.0.7, you can use a container tag:

<txp:section_list>
    <li>
        <a href="<txp:site_url/><txp:section/>/" id="nav-<txp:section/>">
            <txp:section title="1"/>
        </a>
    </li>
</txp:section_list>

But if you’re not running SVN, check out cbs_navigation_menu.

Offline

#4 2008-06-22 16:17:33

Joey
Member
From: Netherlands
Registered: 2005-01-19
Posts: 257

Re: Give links a unique ID

Thanks Els and jm! I’m just running 4.0.6 so Els’ solution works fine for me.


Regards,

Joey

Offline

Board footer

Powered by FluxBB