Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-03-27 16:25:20
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Static home page
I am currently using the following tags on my default page
<code>
<txp:if_category name = “Contact,Portfolio,Services,”>
<txp:article limit=1 form=“portfolio” status=“sticky” />
</txp:if_category>
<txp:if_category name = “Journal”>
<txp:article form=“default” listform=“excerpt” />
</txp:if_category>
<txp:if_search><h1>Search Results</h1><txp:article searchsticky=1 /><p><txp:search_result_count />
</txp:if_search>
<txp:if_individual_article>
<txp:article form=“default”/>
</txp:if_individual_article>
</code>
This does what I want it to do apart from showing any article on the home page ie www.mysite.co.uk
I would like to use the <code><txp:else /></code> tag to display an article on the home page however I am struggling because I have two <code><txp:if_category name = “Contact,Portfolio,Services,Webpraxis,Working-Process”></code> <code><txp:if_category name = “Journal”>
</code>
and dont know how to nest these inside each other and then add an else statement can anyone help
Last edited by beechy (2006-03-27 20:48:38)
Offline
Re: Static home page
It won’t show anything on your front-page for 2 reasons: the “if_category” tag will only display if you are viewing a category list and you are only telling TXP what to do for an individual article whereas the front-page is actually a listing so you need to tell TXP what to use for <code><txp:if_article_list></txp:if_article_list></code>
I think your search should work but I bet that’s no consolation is it? ;)
What exactly do you want on the front-page would be a good place to start?
Oh, and you can’t “nest” the same tag inside itself.
Last edited by thebombsite (2006-03-27 17:16:45)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#3 2006-03-27 17:48:14
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Static home page
Adding this for the frontpage output should work:
<code>
<txp:if_category>
<txp:else />
here your article tag for the front page
</txp:if_category>
</code>
Offline
#4 2006-03-27 20:38:08
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: Static home page
thanks for those suggestions
using
<code>
<txp:if_category>
<txp:else />
here your article tag for the front page
</txp:if_category>
</code>
I now have content showing on my home page but it also shows for my sections and when I do a search is there anyway round this?
Last edited by beechy (2006-03-27 20:39:33)
Offline
Re: Static home page
I think we need more information beechy. Are you using the “archive” page template for your “individual_article” view (where the comments would appear)? If you are then in the “Sections” tab the section called “article” will show that it is using the “archive” template.
And the “if_category” tags that you originally had. Were you using those to define the display of a category listing using different forms for different categories?
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#6 2006-03-28 11:02:41
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: Static home page
at the moment I have the site setup in the following way
I am using messy urls
My main menu is using catagories ie:
<code><txp:category_list wraptag=“ul” break=“li” ul id=“nav” /></code>
I have two sections using the default template and 5 sections using another seperate template
My static pages,articles & comments use the default template which has the following code in the main body
<code>
<txp:if_search><h1>Search Results</h1><txp:article searchsticky=1 /><p><txp:search_result_count />
</txp:if_search>
<txp:if_category name = “Contact,Portfolio,Services,Webpraxis,Working-Process”>
<txp:article limit=1 form=“portfolio” status=“sticky” />
</txp:if_category>
<txp:if_category name = “Journal”>
<txp:article form=“default” listform=“excerpt” />
</txp:if_category>
<txp:if_section name=“RSS,Accesibility-Statement,portfolio,journal”>
<txp:article limit=1 form=“portfolio” status=“sticky” />
</txp:if_section>
<txp:if_individual_article>
<txp:article form=“default”/>
</txp:if_individual_article>
<txp:if_section name=”“>
<txp:article id=12 />
</txp:if_section>
</code>
Everything is working exactly as I want it. However nothing shows up on the home page www.mysite.co.uk
If I use
<code>
<txp:if_section name=”“>
<txp:article id=12 />
</txp:if_section>
</code>
to display an article on the homepage it also show up on the catagories and searches
Is there a way to hide the homepage article on these pages.
Last edited by beechy (2006-03-28 11:03:49)
Offline
Re: Static home page
Try this:-
<code>
<txp:if_section name=”“>
<txp:if_category>
<txp:else />
<txp:article id=12 />
</txp:if_category>
</txp:if_section>
</code>
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#8 2006-03-28 16:24:55
- beechy
- Member
- Registered: 2006-03-02
- Posts: 92
Re: Static home page
Am almost there now…
thanks for that it works well apart from when you do a search and the homepage article shows up above the search is there anyway of getting it off the search results.
Offline
Re: Static home page
Well you might consider sending the search results to their own section as per zem’s article here or you could try:-
<code>
<txp:if_section name=”“>
<txp:if_category>
<txp:else />
<txp:if_search>
<txp:else />
<txp:article id=12 />
</txp:if_search>
</txp:if_category>
</txp:if_section></code>
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Pages: 1