Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-03-27 08:12:21

azw
Member
Registered: 2007-01-29
Posts: 279

How to add the title attribute to HTML links with the section tag?

I’ve done several searches and not found an answer.

In my site navigation, each link looks like this in the HTML output:

<li id=“section-name” class=“nivel-1”><a href=“http://site-url.com/section-name”>Section-Title</a></li>

The txp code that produces this is:

<li id=“section-name” class=“nivel-1”><txp:section name=“section-name” title=“1” link=“1” />

I would like to include the title attribute in the link. Is there a way to do that? The HTML output should look something like this:

<li id=“section-name” class=“nivel-1”><a href=“http://site-url.com/section-name” title=“read about XYZ”>Section-Title</a></li>

I think the title attribute content would have to be customizable to be useful.

Offline

#2 2008-03-27 08:22:47

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: How to add the title attribute to HTML links with the section tag?

Would something like this work for you:-

<li id=“section-name” class=“nivel-1”><a href="<txp:site_url /><txp:section />" title="Go to <txp:section title="1" /> section"><txp:section title="1" /></a></li>

Edit: Actually, that would only work in the appropriate section which I don’t think is what you want. :(

Last edited by thebombsite (2008-03-27 08:28:21)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#3 2008-03-27 08:58:37

azw
Member
Registered: 2007-01-29
Posts: 279

Re: How to add the title attribute to HTML links with the section tag?

Ah, I see. What you’re suggesting is that I manually create the entire link. That might work because in the site nav I’m naming each section anyway. Thanks, Stuart.

Offline

#4 2008-03-27 09:08:57

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: How to add the title attribute to HTML links with the section tag?

Well how are you creating it now? Is it the result of a TXP tag?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2008-03-27 10:12:45

azw
Member
Registered: 2007-01-29
Posts: 279

Re: How to add the title attribute to HTML links with the section tag?

Yes, it is just the section tag

<txp:section name=“section-name” title=“1” link=“1” />

Offline

#6 2008-03-27 17:52:50

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: How to add the title attribute to HTML links with the section tag?

Core tags don’t allow this. Try cbs_navigation_menu plugin


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#7 2008-03-27 18:00:01

azw
Member
Registered: 2007-01-29
Posts: 279

Re: How to add the title attribute to HTML links with the section tag?

Thanks, Victor, I think I’ll have to manually write the link because my navigation has more usability features than cbs_navigation_menu did last time I looked at it.

Offline

#8 2008-03-28 08:37:18

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: How to add the title attribute to HTML links with the section tag?

I think you could use code similar to what I posted above with if_different and article_custom tags. The real problem I foresee with that is the ordering of the output.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#9 2008-03-28 10:10:23

azw
Member
Registered: 2007-01-29
Posts: 279

Re: How to add the title attribute to HTML links with the section tag?

I’ll take another look but part of the problem I’ve got is that there are all sorts of conditionals so that there aren’t links for the current page. Since we can’t use the same conditionals inside each other this limits what I can do. It’s pretty complex. (I didn’t show the complete code because it’s a lot more lines.)

Offline

Board footer

Powered by FluxBB