Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-08-05 22:00:15

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

[resolved] specify multiple sections with article_custom

Textbook says it’s OK:

section=“section name”

  • Restrict to articles from specified section(s).
  • Value: (comma separated list of) section name(s).

But whenever I specify comma separated section names for the section attribute of txp:article_custom it returns nothing.

eg. <txp:article_custom section="news,events" /> returns nothing, but <txp:article_custom section="news" /> and <txp:article_custom section="events" /> work fine

Unless it’s down to user error I guess this must be a known issue, but I can’t find any mention of it on the forum. Can anyone shed any light on it?

thanks
Stu

Offline

#2 2009-08-05 22:37:15

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [resolved] specify multiple sections with article_custom

You’re not using a pre-4.0.6 version, are you?

Offline

#3 2009-08-06 07:21:51

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: [resolved] specify multiple sections with article_custom

Nope – 4.0.8. Have I broken it?

Offline

#4 2009-08-07 05:09:53

monicahu
Member
From: Sydney NSW
Registered: 2009-03-07
Posts: 69

Re: [resolved] specify multiple sections with article_custom

pieman wrote:

<txp:article_custom section="news,events" /> returns nothing, but <txp:article_custom section="news" /> and <txp:article_custom section="events" /> work fine

I have this in my site Textpattern version: 4.0.8 (r3085)

<txp:article_custom status=“live” section=’<txp:section />,events,news,prayers’ category=’<txp:section />’ limit=“1” form=“single” sort=“posted desc” />

and it runs OK. I pay particular attention not to have any space between the section names.


Monica
Life with God is the purpose.

Offline

#5 2009-08-07 10:00:19

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: [resolved] specify multiple sections with article_custom

I’ve run a tag trace of three article_custom calls
  1. journal section only
  2. recommended section only
  3. both together

It doesn’t seem to be specific to these sections – any combination of valid section names (which include live articles) produces the same problem. I’ve also tried with and without a space following the comma in the section attribute.

<txp:article_custom section="journal" wraptag="ul" form="article_editorial_teaser" limit="1" sort="posted desc" />
	[SQL (0.00119709968567): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and Section IN ('journal') order by posted desc limit 0, 1]
	[article 1021]
	[SQL (0.000138998031616): select Form from txp_form where name='article_editorial_teaser']
	[Form: article_editorial_teaser]
	(... followed by form output)

<txp:article_custom section="recommended" wraptag="ul" form="article_editorial_teaser" limit="1" sort="posted desc" />
	[SQL (0.00043797492981): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and Section IN ('recommended') order by posted desc limit 0, 1]
	[article 1022]
	[Form: article_editorial_teaser]
	(... followed by form output)

<txp:article_custom section="journal,recommended" wraptag="ul" form="article_editorial_teaser" limit="1" sort="posted desc" />
	[SQL (0.000365018844604): select *, unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod from textpattern where 1=1 and Status = 4 and Posted <= now() and Section IN ('journal,recommended') order by posted desc limit 0, 1]
[ ~~~ secondpass ~~~ ]
	(... followed by zilch)

Offline

#6 2009-08-07 10:26:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,447
Website GitHub

Re: [resolved] specify multiple sections with article_custom

pieman’s tag trace wrote:

and Section IN (‘journal,recommended’)

Hmmm. Well the problem is there. The trace should read:

and Section IN ('journal', 'recommended')

so for some reason it’s not quoting the list properly. As a long shot, can you just check line 670 of textpattern/publish.php please. It should read:

$section   = (!$section)   ? '' : " and Section IN ('".join("','", doSlash(do_list($section)))."')";

If that’s ok then my only other guess is some weird character set / UTF issue where, for some reason, TXP is not recognising the comma as a delimiter.

Last edited by Bloke (2009-08-07 10:28:51)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2009-08-07 11:12:51

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: [resolved] specify multiple sections with article_custom

OK, thanks Stef.

I had totally forgotten that I’m using Gerhard’s 4.0.8 – in which that line has been amended.

If I restore to the default then article_custom works as expected. One problem solved, another created!

Offline

Board footer

Powered by FluxBB