Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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…
- if_different + acticle_custom
- section_list
And so-on… I can write an example if you want.
Cheers!
Offline
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
- 1st Article from
- family (section name)
- 1st Article from
family
section - 2nd Article from
family
section - … another articles
- 1st Article from
- people (section name)
- 1st Article from
people
section - 2nd Article from
people
section - … another articles
- 1st Article from
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
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
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
Re: Cycle through sections
Offline