Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-01-08 10:32:36

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Cycle through sections

The idea is quite simple – make some cycle for passing through sections with ability to substitute the current section name. I think example can make clear my request :)

Example:

<txp:cycle type="section">
<article_custom section="<txp:cycle current_section_name="1" />" />
<txp:cycle />

So it look like php’s foreach ($section as $current_section_name) where $section is an array of site’s sections. I guess this feature can be useful for menu building, because we don’t need manually list all our sections.

Best regards, Victor from Belarus :)


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#2 2008-01-08 11:11:30

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

Re: Cycle through sections

It’s still unclear what you request, to me anyway. So, you mean that it outputs all sections but throws content only from the current section? Or it just outputs the section list where is content? Er, you can do it with multiple ways…

  1. if_different + acticle_custom
  2. section_list

And so-on… I can write an example if you want.

Cheers!

Offline

#3 2008-01-08 11:21:35

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: Cycle through sections

Hm.. Imagine you have 3 sections – about, family, people. We want to build menu like:

  • About (section name)
    • 1st Article from About section
    • 2nd Article from About section
    • … another articles
  • family (section name)
    • 1st Article from family section
    • 2nd Article from family section
    • … another articles
  • people (section name)
    • 1st Article from people section
    • 2nd Article from people section
    • … another articles

So, if we use <txp:cycle /> we can run through sections and output some section sensitive information withing current cycle iteration.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#4 2008-01-08 11:39:01

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

Re: Cycle through sections

As I said, there is million ways. There is one, that is the most easiest.

<txp:article_custom sort="section ASC" form="tree" />

And in tree:

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

As Textpattern should be flexible, not heavy and pre-made.

Cheers!

Last edited by Gocom (2008-01-08 11:40:46)

Offline

#5 2008-01-08 11:53:07

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: Cycle through sections

Hm… Nice :) When will if_different manual appear? :)
Thanks for attention!


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#6 2008-01-08 12:17:12

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Cycle through sections

the_ghost wrote:

When will if_different manual appear? :)

Done. Thanks for the real-life example.

Offline

Board footer

Powered by FluxBB