Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pageless sections content can't be called via article_custom?
Hi.
I have the following snippet to call the current year, either by PHP or (if PHP tags on pages are disabled in prefs), via a custom field tag…
<txp:variable name="year"><txp:evaluate query='<txp:php />'><txp:php>echo date('Y');</txp:php><txp:else /><txp:article_custom fields="max(posted)"><txp:posted format="%Y" /></txp:article_custom></txp:evaluate></txp:variable>
However, I’ve discovered that if PHP tags disabled and the only articles for the site are stored in a pageless section, then the <txp:article_custom fields="max(posted)">
is empty.
Is the intended behaviour? Seems to work fine if I have articles in any other section – so it’s the pageless section that is causing this.
Offline
Re: Pageless sections content can't be called via article_custom?
I’m not sure what happens if you specify <txp:article_custom>
without giving it more info about where you want to get the articles from. What happens if you add section="your_pageless_section"
to the tag?
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
Re: Pageless sections content can't be called via article_custom?
That works – but <txp:article_custom>
should be default retrieve articles from all sections unless narrowed by using a section
attribute, according to our documentation.
Since I’m building a theme, where I cannot enforce what people label their sections, this is a bit of an issue. Albeit probably not mainstream.
Offline
Re: Pageless sections content can't be called via article_custom?
I’m sure there is a way. Could you try <txp:article_custom searchall />
?
Online
Re: Pageless sections content can't be called via article_custom?
etc wrote #330086:
I’m sure there is a way. Could you try
<txp:article_custom searchall />
?
Ah ha! That works (Textpattern 4.8.5). Has that attribute changed behaviour recently? It’s not listed on the article_custom
tag doc but is mentioned on article
tag doc…
searchall="boolean"
When outputting search results, include only those articles with ‘Include in site search’ set on the Sections panel. If set to 0, only articles in the current section are displayed.
Values:0
(no) or1
(yes).
Default:1
.
Offline
Re: Pageless sections content can't be called via article_custom?
philwareham wrote #330087:
Ah ha! That works (Textpattern 4.8.5). Has that attribute changed behaviour recently – it’s not listed on the
article_custom
tag doc but is mentioned onarticle
tag…
It has been extended to non-search situations when pageless sections were introduced, to include the latter. Works as before when in search.
Online
Re: Pageless sections content can't be called via article_custom?
etc wrote #330088:
It has been extended to non-search situations when pageless sections were introduced, to include the latter.
OK thanks Oleg, great stuff. I think we need to update the docs to reflect this on both article
and article_custom
tag doc pages.
Offline