Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-11-16 16:11:09

slabanosa
Member
From: Silva Carbonaria
Registered: 2004-06-01
Posts: 57

link categories navigation

This is probably very trivial but I can’t seem to wrap my head around it this Sunday. I have a collection of links split in different categories and child categories
  1. distributors
  2. dealers
    • austria
    • belgium
    • etcætera

I have a dedicated section and landing page where I display
h1. Appointed distributors <txp:linklist form="DealerList" category="distributors" limit="10" sort="linksort" labeltag="h1" wraptag="p" />
it displays nicely the links to distributors with all the details from the category links whether I use it in the page template or an article

then to break down the huge list of links within countries I use this to display the subcategories names only
h1. Dealer network p=. *select country* <txp:category_list class="intro" exclude="dealers" parent="dealers" sort="name asc" type="link" breaktag=li wraptag= ul />

again it works fine and spits out the country list (whether I use it in article or in a page template).

from here I’m stuck, when I click on a country name url jumps to
http://sitename/salestest/?c=australia&context=link

but I can’t seem to make the next page display the list of links and details of the selected category
tried this on the page template assuming the category is inherited from the url but no luck
<<txp:if_category type="link"> <txp:linklist form="DealerList" wraptag="p" /> <txp:else /> <txp:article form="article_plain" limit="1" /> </txp:if_category>

any help appreciated, thank you

Last edited by slabanosa (2014-11-18 21:38:37)

Offline

#2 2014-11-17 15:20:41

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: link categories navigation

Weird, seems to work for me (as it should). Is the double << in your post just a typo?

Offline

#3 2014-11-17 20:46:03

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

Re: link categories navigation

Just a quick guess. Does this work?

<txp:if_category name='<txp:category />' type="link"> <txp:linklist category='<txp:category />' form="DealerList" wraptag="p" /> <txp:else /> <txp:article form="article_plain" limit="1" /> </txp:if_category>

Offline

#4 2014-11-17 21:11:57

slabanosa
Member
From: Silva Carbonaria
Registered: 2004-06-01
Posts: 57

Re: link categories navigation

thanks, double << was a typo here and new code does not work so far Els, tagtracing it down to find the culprit
[<txp:if_category type="link">: false]

Offline

#5 2014-11-18 10:25:47

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: link categories navigation

Hey slabanosa – if you’re running Textpattern 4.4.x, you should plan an upgrade soon; it has known security vulnerabilities.

Offline

#6 2014-11-18 11:50:55

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: link categories navigation

Is context altered somehow? Try to output

<txp:php>global $context; echo $context;</txp:php>

on http://sitename/salestest/?c=australia&context=link just before if_category.

Offline

#7 2014-11-18 22:14:45

slabanosa
Member
From: Silva Carbonaria
Registered: 2004-06-01
Posts: 57

Re: link categories navigation

found the culprit in tag trace
[<txp:if_category type="link">: false]

couldn’t find a reason why it does that but ended up with this to do what was initially intended

<txp:variable name="cat"><txp:page_url type="c" /></txp:variable>
<txp:if_variable name="cat" value='<txp:category />'>
<h1><txp:category type="link" title="1" /></h1>
<txp:linklist category='<txp:category />' form="DealerList"  wraptag="p" limit="25" />

still tag trace showed

[<txp:if_variable name="cat" value='<txp:category />'>: true]

that shouldn’t be true on a section page… but if it doesn’t break anything, there ‘s nothing to fix really.
Maybe someone more literate in these things would want to look into that.
thanks everyone and special kudos to Els “Queen of tags” for sorting this out with me

Offline

#8 2014-11-18 23:52:50

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

Re: link categories navigation

Here is a mention (2010!) of if_category not working in combination with gbp_permanent_links and rss_unlimited_categories, but slabanosa is using neither. Still, the problem might be related?

Offline

Board footer

Powered by FluxBB