Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-06-29 14:56:28

mlarino
Member
Registered: 2007-06-29
Posts: 367

sorting articles

I got hundreds of articles I want to sort in different sections and categories,
SECTIONS: Restaurants, Shops, Entertainment
CATEGORY 1: NY, London, Madrid

and also with custom fields
CITY: NY, London, Madrid

Right now all the articles are for only one city “MADRID
I have sorted the articles in their own pages.
INDEX (article list of all articles)
RESTUARANTS (article list of all articles in restaurants)
SHOPS (article list of all articles in shops)
etc…

The problem is now I started uploading content for a new city, for example “LONDON”.

I need to make an article list of only the RESTAURANTS/SHOPS/ETC… in ONE CITY (LONDON, or Madrid, etc…).
How would I do that?

THANKS!

Offline

#2 2009-06-29 15:17:18

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

Re: sorting articles

See:

The section (for example Shops) would hold category_list that lists categories, and on category context, you could use <txp:article /> to show the articles.

Example of a section page:

<txp:if_category>
	<txp:article />
<txp:else />
	<txp:category_list section='<txp:section />' this_section="1" />
</txp:if_category>

Offline

#3 2009-06-29 16:08:33

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: sorting articles

Could you explain that? dont understand what you are trying to say.

Take a look at www.cityexpert (dot) es
Thats is the site, right now displays places from Madrid (Restaurants, etc…)

I want to incluse Sevilla.

So What I nee to do is create pages and sections for the new city, right?

The thing is, what txp tags i need to use to display only an article list from a specific category?

the category will be “Sevilla” (the new city)
I am thinking something like this? :

<txp:article_custom form="fichas" category="sevilla" section="Restuarant"/>

Last edited by mlarino (2009-06-29 16:08:58)

Offline

#4 2009-06-29 16:21:40

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: sorting articles

In the front page I have:

<txp:article limit="14" form="fichas" class="published"/>

That is displaying all the articles published. with a limit of 14

If I want to display the articles that have “Madrid” as a Category, I use this, but is not working:

<txp:article_custom form="fichas" category="Madrid"/>

no articles are displayed.
Madrid is a Category with a bunch of child categories inside.

Offline

#5 2009-06-29 22:23:40

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

Re: sorting articles

First, change your category and section names to all lowercase, it’s not recommended to use capitals there.
Second, if your articles are only in the child categories, and not in the parent category ‘madrid’, your tag is not going to display them. Use this instead:

<txp:article_custom form="fichas" category='<txp:category_list parent="madrid" exclude="madrid" break=","><txp:category /></txp:category_list>' />

Offline

#6 2009-06-30 07:12:51

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: sorting articles

Thanks Els!!!
Yesterday I figured out that Parents dont display their sons, but this fixes everything!
Thanks!

Offline

#7 2009-06-30 08:47:34

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: sorting articles

So,

I have this now:

<txp:article_custom limit="14" form="fichas" category="madrid" class="published"/>

but it doesnt paginate like this one:

<txp:article limit="14" form="fichas" category="madrid" class="published"/>

Is there a way to make “article_custom” paginate to display 14 articles on each page?

Offline

#8 2009-06-30 08:48:52

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: sorting articles

Is there a way to make “article_custom” paginate to display 14 articles on each page?

no, article_custom does not support pagination


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2009-06-30 08:57:18

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: sorting articles

&/”%/!!!
Oh Oh…
So article custom is not something I can use then… I need it to paginate, because I am displaying 14 articles per page. and have buttons to navigate to the next 14… etc…

So can I make an article tag that will only display articles from one category?
this is not working beause doesnt limit the output to the specific Category (only limits it when its article_custom)

<txp:if_section name="madrid">
  <txp:article limit="10" form="fichas" category="madrid" section="restaurantes-y-bares"/>
</txp:if_section>

<txp:if_section name="london">
  <txp:article limit="10" form="fichas" category="london" section="restaurantes-y-bares"/>
</txp:if_section>     

<txp:if_section name="nyc">
  <txp:article limit="10" form="fichas" category="nyc" section="restaurantes-y-bares"/>
</txp:if_section>

Last edited by mlarino (2009-06-30 08:59:01)

Offline

#10 2009-06-30 09:27:21

amordecosmos
Plugin Author
From: London (Hometown: Vancouver)
Registered: 2004-08-03
Posts: 114
Website

Re: sorting articles

The chh_article_custom plugin (Here) is what you need.

It paginates like txp:article but accepts section and category.

<txp:chh_article limit=“14” form=“fichas” category=“madrid” class=“published”/>

(Note that the same plugin creates both <txp:chh_article /> and <txp:chh_article_custom />)

Offline

#11 2009-06-30 09:30:55

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: sorting articles

Thanks amordecosmos!
I will give that a try!

Offline

#12 2009-06-30 09:41:50

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: sorting articles

That plugin is not supported anymore… have you tested that in the latest txp install?

Offline

Board footer

Powered by FluxBB