Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
txp:section_list as a container tag error
Hello,
Firstly, many thanks for the excellent work on 4.0.7! It’s a great feeling removing superfluous code and hacks from my sites thanks to the new tags and features.
One tag change I’m particularly interested in using is <txp:section_list /> as a container tag, however for me it causes problems with any <txp:section /> tags which appear afterwards.
A basic example as follows:
<p>current section: <txp:section /></p>
<txp:section_list sections="about,contact" />
<p>current section: <txp:section /></p>
This works correctly and results in:
current section: about
about
contact
current section: about
Now using <txp:section_list /> as a container tag:
<p>current section: <txp:section /></p>
<txp:section_list sections="about,contact">
<txp:section />
</txp:section_list>
<p>current section: <txp:section /></p>
This incorrectly results in the <txp:section /> tag used after <txp:section_list /> displaying the last section defined in <txp:section_list />, as follows:
current section: about
about
contact
current section: contact
I originally thought this was caused by using <txp:section /> within <txp:section_list />, however I’ve tested this and the error still appears regarldess of the container contents.
I’ve also tried a fresh install and the same problem exists.
Maybe I’ve misunderstood how this should work, but any help would be appreciated.
Thanks again,
Kalon
Last edited by hidalgo (2008-12-03 05:51:35)
Offline
Re: txp:section_list as a container tag error
Confirmed. After using seciton_list()
’s $thing
, it leaves $thissection
global array filled with last output section list item. And because section()
is ordered to use $thissection
as primary if it is filled, it outputs that section.
To fix, simplest method is either to:
- Unset
$thissection
insection_list()
at line 1100 - Add
$s != $thissection
relative check tosection()
function - Rearrange
$s
and$thissection
elseif checks insection()
.
If it is intentional to overriwrite $thissection
then first/3 fix is kinda correct (or place/relativeness check), if it is bug from line one, then it must be rewritten (that section list container way is little messy, guys). Sleepy sleeper coding happened? ;P
Edit. Same bug aplies to category_list()
and category
. Same fixes work those too.
Last edited by Gocom (2008-12-03 08:00:07)
Offline
Re: txp:section_list as a container tag error
Fixed in r3037.
Offline
Offline
Re: txp:section_list as a container tag error
Watching others work is always easy.
Offline
Re: txp:section_list as a container tag error
Offline
#7 2008-12-03 10:43:13
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: txp:section_list as a container tag error
I hope this won’t be considered a totally stupid question. Anyway, wouldn’t it be appropriate to insert this change in the official download?
Yes, I know this could have some drawbacks and create some confusion, but maybe – considered all the pros and cons – it should be taken into consideration.
Offline
Re: txp:section_list as a container tag error
It will be part of the next official release. Changing an existing release would be very very confusing.
Offline
#9 2008-12-03 14:06:08
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: txp:section_list as a container tag error
ruud wrote:
It will be part of the next official release. Changing an existing release would be very very confusing.
Ok ruud
Offline
#10 2008-12-06 15:33:55
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: txp:section_list as a container tag error
ruud wrote:
It will be part of the next official release. Changing an existing release would be very very confusing.
I think now that TXP is getting more advanced we should move into the realm of point release (4.7.1) as waiting six months for a small fix to existing functionality is a bit too much.
Offline