Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-23 16:50:48

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Static home page AND category navigation

Can’t seem to find this by searching, Googling or in the Textbook, sorry

I want to show a single article on the home page (aka static) as described on Zem’s site so have successfully got a form, type “Article”, and saved as “static_article”.

<code>
<h3><txp:title /></h3>
<p><i><txp:excerpt /></i></p>
<txp:body />
</code>

And this would be fine except it’s the homepage that I want to display only a single article… so I’ve now got default calling this single file like this:

<code>
<txp:article limit=1 form=“static_article” />
</code>

…because the homepage uses default right? And that would work fine except I’ve also got my article

categories set up as navigation using rss-suparchive-bycat

And this seems to want to use ‘default’ page, too!

<code>
<txp:rss_suparchive_bycat showcatsonly=“1” />
</code>

So, if the articles are displayed by category only one appears…
…but if I increase the number of articles E.g.

<code>
<txp:article limit=15 form=“static_article” />
</code>

then 15 articles will appear on the homepage, too!!

I’ve tried using conditional stuff like txp:if_section but can’t seem to filter out the homepage from everything else, because the categories don’t have a section either :-(

Hopefully I’m just missing something simple here.

Thanks in advance, Gavnosis

Offline

#2 2006-01-23 19:21:33

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: Static home page AND category navigation

You could use <code><txp:article pgonly=“1” limit=“15” /></code>, then select the article for display with <code><txp:article_custom /></code>.

You might also look at “sticky” status for article display control, then “pgonly” to generate statisics; both methods should work.

[edit]
When you say “by categories”, do you mean “category list” navigation or article link navigation by category?

If you are looking for a category sensitive recent article list that you can use on the default page, you might try this: <a href=“http://textcastle.com/index.php?s=file_download&id=26”>ras_recent_articles</a>, otherwise, recent_articles takes a category attribute.

Last edited by rsilletti (2006-01-23 20:10:25)

Offline

#3 2006-01-23 21:57:20

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Static home page AND category navigation

You could separate a category listing on your front-page by using:-

<code>
<txp:if_category>
<txp:article limit=“6” />
Put the article_list paging tags here
</txp:if_category>
<txp:if_section name=”“>
Your normal front-page code in here
</txp:if_section></code>
<br />

Your category lists would then use the top block and your front-page would use the second block.

All you need to do then is decide what you want to do with search results. ;)

Last edited by thebombsite (2006-01-23 21:58:31)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#4 2006-01-23 23:39:40

gavnosis
Member
From: Milton Keynes, UK
Registered: 2005-03-12
Posts: 151
Website

Re: Static home page AND category navigation

Thankyou kindly both!

I’ve got your method working Stuart, but had to change it slightly because whilst the first part did

indeed keep the categories off the home page, the normal page code was then appearing at the

bottom of the categories ! (because I guess the category pages don’t have a section either).

Anyway. here’s what sems to be working:

<code>
<txp:if_category>
<txp:article limit=“15” />
<txp:else />
Normal front-page code in here
</txp:if_category>
</code>

I’ll get my head round this lot one day!

Thankyou once again for your time, Gavnosis

/*************************************/

Just realised that the above technique restricts searches to single article, too, so added this bit at the front:

<code>
<txp:if_search>
<txp:article limit=“15” />
</txp:if_search>
</code>

Last edited by gavnosis (2006-01-24 20:07:11)

Offline

#5 2006-01-24 02:29:17

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Static home page AND category navigation

I see what you mean. Yep that works.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#6 2006-01-24 07:02:48

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Static home page AND category navigation

thebombsite wrote:
You could separate a category listing on your front-page by using: txp:if_category

On a similar topic, do you know how to achieve the same goal but for /author/ browsing ?

Offline

#7 2006-01-24 09:36:30

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Static home page AND category navigation

I’m afraid not Jeremie. When they got the author link working properly a while back I tried all sorts that I could think of but /author/ doesn’t seem to act like a section or a category. Might be something the devs could have a look at, though I think it would most likely be something for “crockery” as they don’t want to add too much to the current branch. Bug squishing only from what I can gather. Maybe a “feature request”?


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

Board footer

Powered by FluxBB