Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-07 17:52:50

cdd23
New Member
Registered: 2005-09-27
Posts: 3

Format Link Category Labels

I suspect I’m just missing something here but I’ve been going around in circles for a while and can’t figure it out.

I’m trying to format the Link Category names. I’ve got a page on my site for listing external links. I’m using a template called “links” that has the following code within it:

<code>
<txp:linklist form=“Links” category=“film” label=“Film” sort=“linkname asc” />

<txp:linklist form=“Links” category=“music” label=“Music” sort=“linkname asc” />

<txp:linklist form=“Links” category=“books” label=“Books” sort=“linkname asc” />
</code>

The Links form itself is simply this:

<code>
<p><txp:link /><br />
<txp:link_description /></p>
</code>

So my output looks like this:

Film

first film site
first film site description

second film site
second film site description

Music

first music site
first music site description

second music site
second music site description

My question is: How can I format the words “Film” and “Music” (the category labels defined by the “label” tag in the “linklist” tag) in the final output? The “Links” form is formatting for each link entry in each category, but there is no access to the category label itself.

The other question I have is can I use just one “linklist” tag in the template to list all the links for the site organized by category with a label at the top of each? Again, if I do this, I’d like to be able to format the category label independently.

Thank you for your help and attention.

Christopher Dunning

Last edited by cdd23 (2006-03-07 18:40:10)

Offline

#2 2006-03-07 17:58:54

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

Re: Format Link Category Labels

cdd23 wrote:

NOTE: I’ve replaced the “<” characters with “{” in all code above so that it will display in the forum. Is there an easier way to do this? :-)

Yes ;) Wrap your code in < code > < /code > tags (without the spaces).

Offline

#3 2006-03-07 18:42:38

cdd23
New Member
Registered: 2005-09-27
Posts: 3

Re: Format Link Category Labels

Thank you, doggiez! I have altered the post to replace the tags and removed my “NOTE”.

Offline

#4 2006-03-07 19:45:27

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

Re: Format Link Category Labels

Take the labels out of your tags and have them as separate code like so:-

<code>
<p class=“linktitle”>Film</p>
<txp:linklist form=“Links” category=“film” sort=“linkname asc” />
<p class=“linktitle”>Music</p>
<txp:linklist form=“Links” category=“music” sort=“linkname asc” />
<p class=“linktitle”>Books</p>
<txp:linklist form=“Links” category=“books” sort=“linkname asc” /></code>
<br />

then you can style the class “linktitle” how you want. You could also give each title it’s own class if you wish so that you can style them differently.


Stuart

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

Offline

#5 2006-03-07 19:47:48

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

Re: Format Link Category Labels

Good. Now to find you an answer to your questions.

For styling the label you can use the attribute ‘labeltag’, example <txp:linklist wraptag="ul" break="li" label="Music" labeltag="h4" />, and style the h4.

As for creating a linklist with just one tag, you could try something with txp:if_different. But if you are using a list there may be a problem to close it properly (there is a thread about this, can’t find it at the moment).

Edit: oh hi Stuart ;)

Offline

#6 2006-03-07 20:05:49

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

Re: Format Link Category Labels

Hi Els. What kept you? ;)


Stuart

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

Offline

#7 2006-03-08 04:02:20

cdd23
New Member
Registered: 2005-09-27
Posts: 3

Re: Format Link Category Labels

Thank you both for your replies and suggestions.

Pulling it out of the linklist to format makes sense (since I’m specifying it anyway as a parameter within the linklist). And I’ll give the other solution (labeltag attribute) a shot too.

Cheers,
Christopher

Last edited by cdd23 (2006-03-08 04:02:50)

Offline

Board footer

Powered by FluxBB