Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-12-02 23:12:00

jadehouse
Member
Registered: 2007-06-26
Posts: 75

Multiple sections, one archive?

I’m having trouble figuring out how to do this:

/section1/allnews
/section2/allnews
/section3/allnews

etc.

So one news archive that changes per section. I see that pages can’t be used as /section/page though, but I can’t make one archive page that works for all sections off of an “article”. So… what’s the deal?

If it’s really how I’m thinking… uhh, that’s sort of lame. =P

Offline

#2 2007-12-02 23:43:11

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

Re: Multiple sections, one archive?

Categories and conditionals:) Category ‘allnews’ can be used across sections, you could use gbp_permanent_links to have /section/category/ URLs, and on the page template make use of txp:if_category.
asy_wondertag will make it really easy:

<txp:asy_wondertag><txp:if_category name="<txp:category />"></txp:asy_wondertag>
   <txp:article />
</txp:if_category>

If you are using one page template for all sections, wrap this in txp:if_section.

Last edited by els (2007-12-02 23:44:24)

Offline

#3 2007-12-03 04:30:22

jadehouse
Member
Registered: 2007-06-26
Posts: 75

Re: Multiple sections, one archive?

Is it possible without categories? I’m assuming not. Pages can’t be off sections as they’re used for sections, but with our current setup I can’t really rig an article to take the job of an archive across multiple sections.

Offline

#4 2007-12-03 16:21:11

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

Re: Multiple sections, one archive?

Maybe I didn’t quite get what you’re after. Could you give an example what the archive page should look like?

Offline

#5 2007-12-04 22:09:59

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Multiple sections, one archive?

Are you after one page that is an archive of all your sections? If so, just make a new section and use article_custom on it.

Offline

#6 2007-12-16 17:46:31

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Multiple sections, one archive?

Mmm, something similar, trying to pull out the latest 5 posts from various sections into a page, but article_custom does not support more than one section.

This would be perfect:

<txp:article_custom section="news,sport,life" limit="5" form="article_list" />

Since this does not work, the alternative is to use three article_custom tags, but that’s a bit much. Anyone found a better way? I am not going to use categories, so that’s not an option here.

Offline

#7 2007-12-16 18:05:09

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

Re: Multiple sections, one archive?

jstubbs wrote:

Mmm, something similar, trying to pull out the latest 5 posts from various sections into a page, but article_custom does not support more than one section.

Changed tag: <txp:article_custom /> allows comma-separated lists for category, section and author attributes

Offline

#8 2007-12-16 18:20:20

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Multiple sections, one archive?

Awesome! You know which revision it was, so I can edit the appropriate TXP file to update it?

Offline

#9 2007-12-16 18:44:02

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

Re: Multiple sections, one archive?

Since this does not work, the alternative is to use three article_custom tags, but that’s a bit much. Anyone found a better way? I am not going to use categories, so that’s not an option here.

One way is use inside the article form:

<txp:if_article_section name="news,sport,life"><txp:if_article_section>

Cheers!

Offline

#10 2007-12-16 18:53:58

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Multiple sections, one archive?

Interesting…what do you use for the article_custom tag?

Offline

#11 2007-12-16 19:00:30

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Multiple sections, one archive?

Well I put in this in the page:

<txp:article_custom limit="5" form="blog_list" />

And this in the blog_list form:

<txp:if_article_section name="">
<h3 class="blogh3"><txp:permlink><txp:title /></txp:permlink></h3>
</txp:if_article_section>

And it works very nicely….TXP and people like Jukka are always full of surprises :-)

Offline

#12 2007-12-16 19:14:29

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

Re: Multiple sections, one archive?

TXP and people like Jukka are always full of surprises :-)

Thank you :)

Offline

Board footer

Powered by FluxBB