Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-01-16 15:27:51
- stoi
- New Member
- Registered: 2007-01-16
- Posts: 3
How do i add a class to a <txp: link />
Hi, i have an inherited a companies website to update and the whole thing is in textpatten which is alien to me so am having to quickly learn it all. I have searched for the answer to this question with no luck so was hoping someone here could help me.
It seems to be an obvious thing to want to do, but i just cant seem to manage it. There is a series of lists of links which have been created with <txp: linklist> and obviously this uses <txp: link >. All i want to do is add a seperate class within the <a> tag that is generated for each list link item, but i just cant seem to find out how to do this!! The last 2 days have been very frustrating as i am sure there must be an obvious way to do this.
Thanks in advance.
Offline
Re: How do i add a class to a <txp: link />
Hi Stoi.
Just create a new form with the type “link”, call it something like “link-my-form” add the following, then save:
<a class="<txp:link_name/>" href="<txp:link_url />">
<txp:link_name escape="html" />
</a>
then call it from your link list, with any other attributes you like, like this…
<txp:linklist form="link-my-form" />
Using forms is the best part about tTXP… Hope that helps
Last edited by mrdale (2007-01-16 16:19:14)
Offline
#3 2007-01-18 16:21:42
- stoi
- New Member
- Registered: 2007-01-16
- Posts: 3
Re: How do i add a class to a <txp: link />
Hi mrdale and thanks for your reply, but all i seem to get are errors for each of the 4 links. This is what is shown in the browser at the top of the screen.
tag_error <txp:link_name/> -> Textpattern Warning: unknown_tag
tag_error <txp:link_url/> -> Textpattern Warning: unknown_tag
tag_error <txp:link_name escape=“html” /> -> Textpattern Warning: unknown_tag
Here is the code i am using in the form
<code>
<a class=”<txp:link_name/>” href=”<txp:link_url />”>
<txp:link_name escape=“html” />
</a>
</code>
actually if I sub <txp:link_name> for just <txp:link> then I do see the text for the link that i want to appear. Are these old tags then as i dont know what to swop link_name and link_url to!?
OK, after some more research it appears link_name is not supported!! <a href=“http://blog.vibe9design.com/article/adding-support-for-the-linktext-tag-in-textpattern”>read here</a>. I am assuming then link_url is also not supported? Sheesh i wish there was a guidebook to this stuff.
Last edited by stoi (2007-01-18 16:23:25)
Offline
Re: How do i add a class to a <txp: link />
Hmmm. Didn’t know that, just skimming through textpattern.net Assumed the tag worked.
did you make sure your form was a “links” form? What TXP version are you running?
Last edited by mrdale (2007-01-18 18:59:00)
Offline
#5 2007-01-19 09:40:43
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: How do i add a class to a <txp: link />
What TXP version are you running?
I can tell by those errors he’s using an outdated version.
Offline
#6 2007-01-19 10:14:41
- stoi
- New Member
- Registered: 2007-01-16
- Posts: 3
Re: How do i add a class to a <txp: link />
Ah thanks guys, i will check the version and see about updating it. As i said in a new job and am new to all this stuff. Going to persevere with it tho.
Offline