Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-05-29 18:00:45

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

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

#3 2010-05-30 09:48:08

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

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

#5 2010-05-30 12:09:02

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

Re: if_category listings - landing page help

Thanks els! That works brilliantly.


its a bad hen that wont scratch itself.
photogallery

Offline

#6 2010-06-01 23:32:10

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

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

#8 2010-06-02 08:34:51

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

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

#10 2010-06-02 21:10:10

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

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

#12 2010-06-02 21:30:54

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

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

#13 2010-06-02 21:52:43

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

Re: if_category listings - landing page help

Is ‘Allow form override’ in Advanced preferences set to ‘yes’? Did you enter a form in the Override form field? Tag trace?

Offline

#14 2010-06-02 22:50:45

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

Re: if_category listings - landing page help

hmm…

[SQL (0.000330209732056): 
			Tag error:  <txp:category title="1" link="1" wraptag="li"  name="auctioneers"  allowoverride="1"  sort="Title desc"  /> -> Textpattern Notice: Unknown tag attribute: allowoverride  on line 699

its a bad hen that wont scratch itself.
photogallery

Offline

#15 2010-06-02 22:51:36

kvnmcwebn
Member
From: Ireland
Registered: 2007-01-27
Posts: 724
Website

Re: if_category listings - landing page help

don’t know how that got in the category tag

…..
edited to say that wasn’t the problem..

allowoverride working in other parts of the site so not sure..

Last edited by kvnmcwebn (2010-06-02 23:00:23)


its a bad hen that wont scratch itself.
photogallery

Offline

Board footer

Powered by FluxBB