Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[solved] Creating a list of articles from the current section
Uhm, I’m at a loss here … whereas I can get a list of all articles in a current category with
<txp:article_custom category='<txp:category />' wraptag="ul" break="li" sort="title asc" />
… the same does not work for sections:
<txp:article_custom section='<txp:section />' wraptag="ul" break="li" sort="title asc" />
Am I missing something?
Cheers,
-f
Last edited by funtoosh (2013-05-15 09:39:26)
Offline
Re: [solved] Creating a list of articles from the current section
hi
is it the /> missing at the end? elswhere the code seems correct for me (but havent tested xhat happen in the default section e.g section=’‘ )
Cheers
Offline
Re: [solved] Creating a list of articles from the current section
Rabah, no, that’s not the mistake, i just forgot that above .-)
I’ll correct that.
Offline
Re: [solved] Creating a list of articles from the current section
Hi
Are you sure you have articles in that section?
But what is the interest of that code? if you use txp:article it will work without needing the txp:section or the txp:category.
Offline
Re: [solved] Creating a list of articles from the current section
Hi,
the purpose is to use the article list as sub navigation. I’d like to display a list of all articles of each section in a sidebar, without having to specify the single names of the sections in separate forms for the sidebars.
Offline
Re: [solved] Creating a list of articles from the current section
funtoosh wrote:
Hi,
the purpose is to use the article list as sub navigation. I’d like to display a list of all articles of each section in a sidebar, without having to specify the single names of the sections in separate forms for the sidebars.
If you just want the article list for each section to appear within it’s own section, then you can just use a normal <txp:article /> tag like this:
<txp:article limit="999" wraptag="ul" break="li" sort="title asc">
<txp:permlink><txp:title /></txp:permlink>
</txp:article>
Otherwise, if you want a global menu with articles appearing nested within the section navigation, I suggest taking a look at adi_menu which is a rather good way of doing this.
Offline
Re: [solved] Creating a list of articles from the current section
Steve, while your solution without the _custom works on section pages, it does not work on an individual article page.
The thing that annoys me about the section=”<txp:section />” not working is that it does work when I type an individual sections name in there. So what’s wrong with using <txp:section /> when <txp:category /> does the trick . . . . .
Offline
Re: [solved] Creating a list of articles from the current section
Hi
can you put your website on debugging mode and see the source of your page, you will then see all the queries and results.
Cheers
Offline
Re: [solved] Creating a list of articles from the current section
Bonjour Rabah, good idea, here’s what I get:
<txp:article_custom form="article_listing" limit="20" sort="Title" section="<txp:section />" category="<txp:category />" />
[SQL (0,00051403045654297): 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
(now() <= Expires or Expires = '0000-00-00 00:00:00') and (Category1 IN ('<txp:category />') or Category2 IN ('<txp:category />'))
and Section IN ('<txp:section />') order by Title limit 0, 20]
No output generated. article_listing is the unchanged default form.
Doesn’t really help, does it?
Mhm, am I overlooking something trivial here …
Do I have to use variables instead of <txp:section />?
Offline
Re: [solved] Creating a list of articles from the current section
Oooops, bad and obvious and trivial mistake: must use single quotes with txp tags as attributes:
<txp:article_custom form="article_listing" limit="20" sort="Title" section='<txp:section />' />
[schäm]
Offline
Re: [solved] Creating a list of articles from the current section
Happy you found the error!
Offline
Re: [solved] Creating a list of articles from the current section
Merci beaucoup de m’aider!
Offline