Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-02-09 00:34:47

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

Re: Links and pages structure? A bit confused?

Well, I haven’t found the perfect solution. To have some more flexibility in ordering the menu items (sections and categories) other than alphabetically, you’d need one of the navigation plugins or section_list and category_list. But as far as I can see none of those can display the three level navigation you want. You could handcode the entire menu, but then it would not automatically be updated when new sections/categories/articles are added. So here’s a compromise.

Starting point is that your first level items are sections, second level are categories, and third level are articles, and the menu has to look like this:

Section 1
   Category 1
      - article
      - article
   Category 2
      - article
      - article
Section 2
   Category 3
      -article
...etcetera...

With my example you won’t be able to sort sections and categories other than alphabetically, but you could change the section and category names to sort them the way you want (this will only show in the URL), for instance 01-about, 02-community, etcetera. For the article sort I have used title in my example, but you can also use a custom field to sort on if no other existing possibilty suits you.
gbp_permanent_links can create the /section/category/title URLs. Other than that, you only need asy_wondertag.

On the page:

<txp:article_custom form="navigation" sort="section asc, category1 asc" />

Article form ‘navigation’:

<txp:if_different>
<h2><txp:section title="1" link="1" /></h2>
</txp:if_different>

<txp:if_different>
<h3><txp:category1 title="1" link="1" /></h3>
</txp:if_different>

<txp:if_different>
<txp:asy_wondertag><txp:article_custom section="<txp:section />" category="<txp:category1 />" form="article_list" sort="title asc" /></txp:asy_wondertag>
</txp:if_different>

Article form ‘article_list’:

<txp:if_first_article><ul></txp:if_first_article>
<li><txp:permlink><txp:title /></txp:permlink></li>
<txp:if_last_article></ul></txp:if_last_article>

To collapse/expand menu items you could use jquery (example here) and you’ll have to add some classes here and there.

As I said this method is not perfect, you may not want to use it at all. But at least it will give you an impression of what TXP can do :)

Last edited by els (2008-02-09 00:41:35)

Offline

#14 2008-02-09 22:16:48

Alfie
Member
Registered: 2007-11-06
Posts: 40

Re: Links and pages structure? A bit confused?

Cheers for the quick response and great detail, not really had a chance to implement/test it yet but
will let you know how i get on soon

cheers again!!!

Alfie

Offline

#15 2008-02-11 10:38:05

Alfie
Member
Registered: 2007-11-06
Posts: 40

Re: Links and pages structure? A bit confused?

Been working all weekend so havn’t had chace to do anything with the site, but I just had a great idea! When i click on one of the main sections on the horizontal nav at the top of the page, it can then go to a list of categeries on the left.

After looking around i found this site : http://waterswinery.com/vineyards, this way i wont need collapsing links… … still need to have a go at implementing it.

Last edited by Alfie (2008-02-11 13:23:00)

Offline

#16 2008-02-11 16:58:27

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

Re: Links and pages structure? A bit confused?

Good idea! And not difficult to achieve. You can go for separate page templates per section, or use the if_section tags. Good luck :)

Offline

Board footer

Powered by FluxBB