Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2014-04-13 07:02:20

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

list 5 new articles of current author

i’ve added the following code to the Default (form):

<txp:article_custom limit="5" form="author_list" author="<txp:author />" /> 

but not works ! could you please help me when any one see the article that should list 5 other articles of current author, except the one article which is reading…

thanks

Offline

#2 2014-04-13 11:52:46

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: list 5 new articles of current author

A TXP tag used as the value of another TXP tag: apostrophes.

Last edited by uli (2014-04-13 11:53:23)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2014-04-13 11:55:56

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

Re: list 5 new articles of current author

See Parsing tag attributes, and article_custom and author tags.

Few pointers:

  1. To parse attribute values, use single quotes.
  2. article_custom’s author attribute expects login names.
  3. author tag defaults to real name, but the title attribute allows changing that.

To exclude the current article, you can either:

  1. Pass list of pre-filtered IDs generated with other article_custom tag to article_custom’s id attribute.
  2. …or if you mind something getting 4 articles, you can wrap the list element contents in if_article_id.

Offline

#4 2014-04-13 15:23:24

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

Re: list 5 new articles of current author

Hi Gocom and Uli thanks a lot :-)
now i can see the articles of the exact author, but didn’t succeed to exclude the current article !

code works fine:

<txp:article_custom author='<txp:author title="0" />' form="author_list" limit="5" />

and tried the following code to exclude the current article, but not works:

<txp:if_article_id>
<txp:else />
<txp:article_custom author='<txp:author title="0" />' form="author_list" limit="5" />
</txp:if_article_id>

Offline

#5 2014-04-13 16:39:33

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: list 5 new articles of current author

Use if_article_id inside your form.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2014-04-13 17:13:05

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

Re: list 5 new articles of current author

but now i’m using that to my pages (template), not in the article, that’s in a corner of my template.

Offline

#7 2014-04-14 10:39:45

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: list 5 new articles of current author

You use if_article_id inside what’s used for its form. If the above means you have a txp:article(_custom) tag as a container on your page then you put if_article_id inside that container. If you mean something else: please be more specific with the code you’re currently using.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#8 2014-04-15 04:18:17

raminrahimi
Member
From: India
Registered: 2013-03-19
Posts: 276

Re: list 5 new articles of current author

wow it’s done ! thanks a lot uli :-) i did the following code to my pages (template)

<txp:article_custom author='<txp:author title="0" />'  limit="5" >
 <txp:if_article_id>
 <txp:else />
   <p><txp:title /></p>
 </txp:if_article_id>
</txp:article_custom>

Offline

#9 2014-04-15 10:29:39

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: list 5 new articles of current author

raminrahimi wrote #280232:

wow it’s done ! thanks a lot uli :-)

You’re welcome, glad it’s working now!


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

Board footer

Powered by FluxBB