Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-12-03 05:33:38

hidalgo
Member
From: Australia
Registered: 2008-02-05
Posts: 77
Website

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

#2 2008-12-03 07:40:46

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

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:

  1. Unset $thissection in section_list() at line 1100
  2. Add $s != $thissection relative check to section() function
  3. Rearrange $s and $thissection elseif checks in section().

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

#3 2008-12-03 07:57:43

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

Re: txp:section_list as a container tag error

Fixed in r3037.

Offline

#4 2008-12-03 08:06:34

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

Re: txp:section_list as a container tag error

wet wrote:

Fixed in r3037.

Thanks for the quick fix :P Wasn’t it easy and small one nullifying/unsetting ;D

Offline

#5 2008-12-03 08:09:52

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

Re: txp:section_list as a container tag error

Watching others work is always easy.

Offline

#6 2008-12-03 08:40:09

hidalgo
Member
From: Australia
Registered: 2008-02-05
Posts: 77
Website

Re: txp:section_list as a container tag error

wet wrote:

Fixed in r3037.

Many thanks!

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

#8 2008-12-03 13:27:43

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

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

Board footer

Powered by FluxBB