Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
if_category listings - landing page help
Hi I’m creating a directory page with a category list.
Everyting is working except that i don’t wan a list of articles on the initial landing page.
But since the initial landing page is not a category the below code will display a list of articles.
I thought i could do something with the “On front page” setting switched to “no” but it’s not working I don’t know.
<txp:if_category>
<h2><txp:category title="1" /></h2>
<txp:article limit="5" wraptag="div" form="plain_listing" >
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<txp:excerpt />
</txp:article>
<txp:else />
<txp:article_custom form="plain_listing" />
</txp:if_category>
<txp:output_form form="category_list" />(this is the form with the category list)
I would like something like:
"<txpif_landing page">
<txp:article_custom id="1" />
<txp:else />
<txp:if_category>
<h2><txp:category title="1" /></h2>
<txp:article limit="5" wraptag="div" form="plain_listing" >
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<txp:excerpt />
</txp:article>
<txp:else />
<txp:article_custom form="plain_listing" />
</txp:if_category>
<txp:output_form form=“category_list” />
Last edited by kvnmcwebn (2010-05-29 18:01:27)
its a bad hen that wont scratch itself.
photogallery
Offline
#2 2010-05-29 18:19:51
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category listings - landing page help
Hi Kevin, what is the landing page if it’s not a category page? Section page? Front page?
Offline
Re: if_category listings - landing page help
hi els,
it’s a section page.
its a bad hen that wont scratch itself.
photogallery
Offline
#4 2010-05-30 11:24:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category listings - landing page help
If I understand you correctly, something like this should work:
<txp:if_section name="yoursection">
<txp:if_category>
<h2><txp:category title="1" /></h2>
<txp:article limit="5" wraptag="div">
<h3><txp:permlink><txp:title /></txp:permlink></h3>
<txp:excerpt />
</txp:article>
<txp:else />
<txp:if_individual_article>
<txp:article form="yoursinglearticleform" />
<txp:else />
<txp:article_custom id="1" />
</txp:if_individual_article>
</txp:if_category>
<txp:output_form form="category_list" />
</txp:if_section>
If you need this for more than one section, change name="yoursection"
to name='<txp:section />'
.
If you have a separate page template for your section, you can of course leave out the if_section tags.
BTW, you can’t have a form
attribute in your article tag if it’s used as a container tag.
Last edited by els (2010-05-30 11:28:31)
Offline
Re: if_category listings - landing page help
Thanks els! That works brilliantly.
its a bad hen that wont scratch itself.
photogallery
Offline
Re: if_category listings - landing page help
Hi El’s.
If you have a minute – How would this work if it was a category page? I have another section in the site with a category drop down like this:
<li> <txp:section link="1" title="1" name="shop" />
<txp:category_list parent="shop" wraptag="ul" break="li" />
</li>
when I select one of the drop down categories it goes to a category page which just goes to my error page. heres the url
http://www.mybetasite.com/category/clothing/
How could I get an articles and article lists to show up on that category page?
its a bad hen that wont scratch itself.
photogallery
Offline
#7 2010-06-02 07:14:05
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category listings - landing page help
Does adding section="shop"
to the category_list tag help?
Offline
Re: if_category listings - landing page help
Hi Els the articles are all ready part of another section so that won’t work.
I’m gonna have to rethink this.
its a bad hen that wont scratch itself.
photogallery
Offline
#9 2010-06-02 18:40:08
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category listings - landing page help
kvnmcwebn wrote:
Hi Els the articles are all ready part of another section so that won’t work.
That’s not the problem. Using section="shop"
in the category_list tag only displays the category’s articles on section shop’s page. It creates URLs like site.com/shop/?c=clothing. If the articles in category clothing are in different sections you just need to use an article_custom tag to display them on the ‘shop’ page.
Offline
Re: if_category listings - landing page help
having trouble with this… but if I could get it going like you said there it would be great.
its a bad hen that wont scratch itself.
photogallery
Offline
#11 2010-06-02 21:20:42
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: if_category listings - landing page help
If you use this:
<txp:category_list section="shop" parent="shop" wraptag="ul" break="li" />
it should create URLs like site.com/shop/?c=category-name. On the page for section shop something like
<txp:if_category>
<txp:article_custom category='<txp:category />' />
</txp:if_category>
should work…
Offline
Re: if_category listings - landing page help
ok is there a reason why the override form wouldn’t work in this example?
<txp:if_section name="services" >
<txp:if_category>
<h2><txp:category title="1" /></h2>
<txp:article allowoverride="1" form="plain_listing" />
<txp:else />
<txp:if_individual_article>
<txp:article form="plain_listing" allowoverride="1" />
<txp:else />
<h3> Select a Category </h3>
</txp:if_individual_article>
</txp:if_category>
<hr />
<txp:output_form form="newlistings" />
</txp:if_section>
its a bad hen that wont scratch itself.
photogallery
Offline