Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-11-21 11:42:12

ballmann
Member
Registered: 2006-10-14
Posts: 37

how to output a list of links in a link-category?

my website has three column layout: on the far left is a list of the sections, a list of the articles of this section in the middle column and on the right side is the choosen article.
i want to adapt this layout for my link-categories: if i choose the section “favourites” on the left it shows a linklist of all link-categories in the second column. but as soon as i click on one of thoose seven categories (art, music, etc.) the whole thing switches to the default-template and i get a tag-error.

how can i get a list of links of one of these link-categories working in the third column?
and not only within the default-template?

Offline

#2 2007-11-21 17:35:28

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

Re: how to output a list of links in a link-category?

What code are you using to display the list of link categories?

Offline

#3 2007-11-21 17:44:50

ballmann
Member
Registered: 2006-10-14
Posts: 37

Re: how to output a list of links in a link-category?

i use “<txp:category_list type=“link” />” to get my categories listed.

Offline

#4 2007-11-21 17:53:47

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

Re: how to output a list of links in a link-category?

Does <txp:category_list type="link" section="favourites" /> take you to the right page?

Offline

#5 2007-11-21 18:46:49

ballmann
Member
Registered: 2006-10-14
Posts: 37

Re: how to output a list of links in a link-category?

ah, this solves the problem with the default-page.
now, this error-message is gone.

but the links that i have under “Content” and “Links” and in seven different categories dont show up in my right column.
the tag for this column is “<txp:article form=“article” />”.
may this tag is completely wrong because the links defined for this category are no articles?
but when i replaced this tag with a linklist-tag i get an errormessage like “this template doesnt contain an article-tag” … or similar.

mmh …

Offline

#6 2007-11-21 18:50:59

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

Re: how to output a list of links in a link-category?

You indeed need txp:linklist. The message about the missing article tag will probably go away when you set production status to ‘live’ (in preferences).

Offline

#7 2007-11-21 19:05:11

ballmann
Member
Registered: 2006-10-14
Posts: 37

Re: how to output a list of links in a link-category?

i tried the linklist-tag before but my links dont show up when i click on one of the categories listed in the second column.
this is the code at the moment:

<div id=“column_2”>
<txp:category_list type=“link” section=“favourites” />
</div>
<div id=“column_3”>
<txp:linklist />
</div>

within my other sections it works wonderful with linklists of my articles in the second column and a click on one of them shows that particular article in the thrid column. how can i manage to show up the linklist of a certain category in the third column?

Offline

#8 2007-11-21 20:02:20

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

Re: how to output a list of links in a link-category?

It doesn’t display anything? I assume you do have links in those categories? The linklist tag uses form ‘plainlinks’ by default. Are you sure that form exists?

To display only links in the chosen category, you could use asy_wondertag:

<txp:asy_wondertag><txp:linklist category="<txp:category />" /></txp:asy_wondertag>

This assumes that the category is in the URL, so when you click a link category in the left column, you should be taken to a URL like site.com/favourites/?c=yourlinkcategory.

Offline

#9 2007-11-21 20:19:49

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: how to output a list of links in a link-category?

Or with just php – no requirement for asy_wondertag:

<txp:php>
	echo linklist(
	array(
		'category' => $GLOBALS['pretext']['c'],
	));
</txp:php>

Cheers!

Last edited by Gocom (2007-11-21 21:50:37)

Offline

#10 2007-11-21 21:05:30

ballmann
Member
Registered: 2006-10-14
Posts: 37

Re: how to output a list of links in a link-category?

hey els – you were absolutely right: i deleted the plainlinks-stuff a few days ago.
thank you very much!
with asy_wondertag the magic happens!
great! i´m so happy :-)

@gocom: i tried the php-thing but i doesn´t happen – regardless which link-categories i clicked it display always the same links.
mmmh … :-(

Offline

#11 2007-11-21 21:37:52

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: how to output a list of links in a link-category?

$globals is usually written uppercase as $GLOBALS, perhaps that’s why it didn’t work?

Offline

#12 2007-11-21 22:13:39

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

Re: how to output a list of links in a link-category?

Gocom wrote:

Or with just php – no requirement for asy_wondertag:

I think there is a very good reason not to use php (at least for us non-coders): using asy_wondertag allows you to easily recognize the code on your page and what you intended it to do. When I see category="<txp:category />" I know exactly what it does, and when I see some php code that someone gave me a year ago, I probably won’t remember what it was for ;)

Offline

Board footer

Powered by FluxBB