Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-05-14 13:35:50

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

[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

#2 2013-05-14 13:43:20

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

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

#3 2013-05-14 13:55:24

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

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

#4 2013-05-14 14:38:27

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

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

#5 2013-05-14 14:48:38

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

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

#6 2013-05-14 15:07:58

springworks
Member
Registered: 2005-01-06
Posts: 172
Website

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

#7 2013-05-14 15:32:28

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

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

#8 2013-05-15 08:17:11

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

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

#9 2013-05-15 09:16:12

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

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

#10 2013-05-15 09:38:57

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

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

#11 2013-05-15 09:40:46

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,549
Website GitHub Twitter

Re: [solved] Creating a list of articles from the current section

Happy you found the error!

Offline

#12 2013-05-15 09:43:29

funtoosh
Member
From: Münster, Germany
Registered: 2006-10-09
Posts: 153
Website

Re: [solved] Creating a list of articles from the current section

Merci beaucoup de m’aider!

Offline

Board footer

Powered by FluxBB