Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-03 13:08:55

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

auto-choose first available category?

hi everybody!

my website is divided into three columns: the left one contains all my sections, the middle one shows the contained articles or categories of a choosen section and the third/right one shows the article or a linklist in one case/section.

is it possible to auto-choose a link-category in a section when i click on the section?
as an example … i´ve got the section “links” on the left side …i click on this and in the 2nd column all of the link-categories show up (art, music, etc.) … but in the last column i see ALL links now. but i just want to see the links contained in the first link-category maybe “art” for example.

so, all i want is that the first category in the 2nd column is auto-selected when i click on the “links”-section.
is this possible?

here is my code:

<div id=“column_2”>
<txp:category_list active_class=“active” type=“link” section=“links” />
</div>
<div id=“column_3”>
<txp:asy_wondertag><txp:linklist category=”<txp:category />” /></txp:asy_wondertag>
</div>

Offline

#2 2007-12-03 16:32:54

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

Re: auto-choose first available category?

Something like this? You’d have to set the default link category manually.

<div id="column_2">
<txp:category_list active_class="active" type="link" section="links" />
</div>
<div id="column_3">
<txp:if_category>
      <txp:asy_wondertag><txp:linklist category="<txp:category />" /></txp:asy_wondertag>
   <txp:else />
      <txp:linklist category="art" />
</txp:if_category>
</div>

Offline

#3 2007-12-03 17:01:29

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

Re: auto-choose first available category?

yeah, this works – thank you :-)
but … the links from “choosen” gallery are shown on the right but in the list of categories the “active” category isn´t highlighted … i have to click on the category “art” to see this category highlighted in the 2nd column.

is there a trick to highlight it as soon as i click the links-section on the left?

Offline

#4 2007-12-03 17:59:30

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

Re: auto-choose first available category?

Hmm… you could try to – partially – hand code the category list:

<txp:if_category>
           <txp:category_list active_class="active" type="link" section="links" />
       <txp:else />
           <txp:category type="link" name="art" link="1" title="1" section="links" class="active" />
           <txp:category_list categories="all,categories,except,art" type="link" section="links" />
</txp:if_category>

Or do something similar with the section list and have the link to section ‘links’ go to /links/?c=art.

Offline

Board footer

Powered by FluxBB