Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-05-14 18:30:49

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Book type navigation: List of categories on a sticky article of the sa

Hello to TXP users!

I am trying to make a kind of book navigation (always wanted to achieve something resembling the Drupal book navigation with TXP).

Example: when a user hits Section “Texts” he goes to a single page (sticky article of the section Texts) with list of categories of the same section “Texts”. I don’t want a list articles from all categories below. Example – http://txp.blagg.co.cc/en-txt/

So I put this code in the sticky article:

<txp:category_list  parent="textx" exclude="texts"  label="Categories" section="Texts" type="article" /> 

In the Page template (presentation -> pages) I added this:

<txp:if_section name="texts">
<txp:article status="sticky" limit="1" form="single" />
<txp:article limit="0" />
<txp:else />
<txp:article limit="5" />
</txp:if_section>

And it works OK in Live mode but in Testing mode the TXP shows:

Warning: Division by zero on line 793

I understand it is not quite right. Is it possible to achieve the same effect in proper way without the system warning?

Last edited by admi (2012-05-15 00:42:57)

Offline

#2 2012-05-14 18:44:47

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,173
Website GitHub Mastodon Twitter

Re: Book type navigation: List of categories on a sticky article of the sa

I would delete <txp article limit="0" />.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2012-05-14 19:10:02

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Book type navigation: List of categories on a sticky article of the sa

colak wrote:

I would delete <txp article limit="0" />.

If I delete <txp article limit=“0” /> there will be no individual article.

Offline

#4 2012-05-14 20:28:12

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,925
Website GitHub

Re: Book type navigation: List of categories on a sticky article of the sa

Just change limit="0" to limit="1".


TXP Builders – finely-crafted code, design and txp

Offline

#5 2012-05-14 20:40:29

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: Book type navigation: List of categories on a sticky article of the sa

jakob was quicker, nevertheless one/two more attempts.

I’ve not yet seen a method limit="0", thus can’t tell what you want to achieve. From my few tests it seems that article lists are suppressed with an error message, whereas individual articles are displayed without error. So, might it be viable that you put an if_individual_article tag around your article tag? Or use it around the 0 limit?

If neither of these gives you hint enough, please hint some more yourself: what do you want to achieve with the zero limit and why. Both might speed up finding a solution.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2012-05-14 21:53:48

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Book type navigation: List of categories on a sticky article of the sa

If neither of these gives you hint enough, please hint some more yourself: what do you want to achieve with the zero limit and why. Both might speed up finding a solution.

With limit=“0” I get rid of list of articles under the sticky page and have just a single article with categories menu in it (like a contents of a book). I can create a sticky page in a different section and use for the same purpose but in this case breadcrumbs will not display the right track because sections of the page where u see a list of categories is different from section where the articles themselves are published.

Here is an example of what I want to achieve http://txp.blagg.co.cc/en-txt/ – sorry for no style, I hope the idea is clear.

Last edited by admi (2012-05-14 22:22:50)

Offline

#7 2012-05-14 21:56:19

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Book type navigation: List of categories on a sticky article of the sa

jakob wrote:

Just change limit="0" to limit="1".

In that case one article will be displayed under the sticky one, and I don’t want that.

Offline

#8 2012-05-15 05:23:18

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,173
Website GitHub Mastodon Twitter

Re: Book type navigation: List of categories on a sticky article of the sa

Hi Andre

There is the soo_if_frontpage with which can detect section front pages If you wish to use a plugin but if your code works in live mode I would stick with the native tags whenever possible.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2012-05-15 08:41:06

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Book type navigation: List of categories on a sticky article of the sa

colak wrote:

Hi Andre

There is the soo_if_frontpage with which can detect section front pages If you wish to use a plugin but if your code works in live mode I would stick with the native tags whenever possible.

Yes, colak, you are right. As a matter of fact, I made one site http://superclimate.by/hokkaido/ with this plugin and such a coding, and you know, there were no warning messages even in Testing mode. But I am, being a little idealistic, trying to achieve this in “kosher” way with no extra plugins and warning messages in Testing mode.

The reason is that I don’t want to use other CMSs (Drupal or Modx, for example, that can create such a structure easier with no extra modules) when it comes to creating a catalogue / book like hierarchy because I believe TXP has more other advantages.

The alternative solution is using adi_menu http://belsvk.by/info/produktsiya but having too many subsections is a headache.

Offline

#10 2012-05-15 09:18:08

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,925
Website GitHub

Re: Book type navigation: List of categories on a sticky article of the sa

In that case one article will be displayed under the sticky one, and I don’t want that.

Ah, ok, I didn’t know that. Would this variant with if_article_list work then?

<txp:if_section name="texts">
  <txp:if_article_list>
    <!-- section landing page -->
    <txp:article status="sticky" limit="1" form="single" />
  <txp:else />
    <!-- individual article -->
    <txp:article />
  </txp:if_article_list>
<txp:else />
  <txp:article limit="5" />
</txp:if_section>

You can also use if_individual_article instead if you turn around the if and else cases.


TXP Builders – finely-crafted code, design and txp

Offline

#11 2012-05-15 15:55:37

admi
Member
From: BY
Registered: 2007-12-10
Posts: 145
Website

Re: Book type navigation: List of categories on a sticky article of the sa

yes, jacob, it works like charm without any warning! That’s what I have been trying to achieve. I had to move navigation to older and newer pages to two different places though. I think the question that bothered me for some time is solved! Thanks a lot.

Last edited by admi (2012-05-15 15:59:47)

Offline

Board footer

Powered by FluxBB