Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-12-29 17:02:14

stormga
Member
Registered: 2008-12-11
Posts: 11

trouble with if_section and if_category

I am very new to textpattern and am having trouble with this website: www.metrostoneworks.com

I want to have the home page unique, and I figured out how to get the home page and the “products” page to display the way I want them to… mostly.

The problem I am having is with the categories within the products – these are different types of products that my client sells, and I need to show a gallery of the color samples for each one. I have managed to get different pieces to work at different times, but when I get one to work (home page, for example) then the individual category does not show up right – it displays the home page, then you have to scroll down to get to see the category gallery, and the placement is all messed up. Here is the code I currently have:
<code>
<txp:output_form form=“leftflr” />
<txp:if_section name=“default”> <txp:article_custom section=“home” form=“home_content”
limit=“1” />

</txp:if_section>

<txp:if_section name=“products” /> <txp:article_custom section=“products” form=“products”
limit=“1” />
</txp:if_section>

<txp:if_section name=“products” />
<txp:if_category name=“corian”>
<txp:article />
<txp:wow_gallery name=“corian” rows=“4” cols=“6” captions=“1” browse=“1” />
</txp:if_category>

<txp:if_category name=“granite”>
<txp:article />
<txp:wow_gallery name=“granite” rows=“5” cols=“6” captions=“1” browse=“1” />
</txp:if_category>

<txp:if_category name=“zodiac”>
<txp:article />
<txp:wow_gallery name=“zodiac” rows=“4” cols=“6” captions=“1” browse=“1” />
</txp:if_category>

</txp:if_section>

<txp:output_form form=“rightflr” />

</code>

On the products page, the “rightflr” is displaying in the wrong place, and on the home page, the contents of the category page are showing up at the bottom without the actual gallery.

Bottom line is that I am having a fit with the if_section and the if_category tags and I would greatly appreciate any help I might find out there in txp-land.

Thanks!

Last edited by stormga (2008-12-29 17:02:35)

Offline

#2 2008-12-29 19:47:43

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

Re: trouble with if_section and if_category

This may be an error in copy/pasting but you have <txp:if_section name="products" /> twice when it should be <txp:if_section name="products">.

Last edited by thebombsite (2008-12-29 19:48:21)


Stuart

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

Offline

#3 2008-12-29 20:03:19

stormga
Member
Registered: 2008-12-11
Posts: 11

Re: trouble with if_section and if_category

Ahhh. thanks.
that solved one part of the problem, but I still cannot get the home page stuff to go away when you click on a particular category.

Offline

#4 2008-12-29 20:45:07

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

Re: trouble with if_section and if_category

From what I see you are confusing section=home with the default section. You have the “rightflr” on your home template (page), but not in the default page.

Categories are displayed by default in the default page, unless instructed to use another page using the section="section name" attribute.

Also note that if the categories are displayed on the default page, only articles that are set to “on front page” in the Sections tab will display.

Offline

#5 2008-12-29 20:58:16

stormga
Member
Registered: 2008-12-11
Posts: 11

Re: trouble with if_section and if_category

Ok, so I am not so worried about the whole “rightflr” thing… I will figure that out once I get the rest of this unraveled. So one other thing I am confused about is that if I click on “products” then on say “corian” I get the page I want, but the gallery with all the corian colors does not show up. If I then click on the breadcrumb “corian” the url changes to …/category/Corian (from …/products/?c-Corian) and I see the home page content, then the gallery of thumbnails with all the colors there… I am so confused.

If I put the if_category tag on the default form, would that work?

Offline

#6 2008-12-29 21:50:48

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

Re: trouble with if_section and if_category

Its all to do with how you have setup your pages and sections. When you are on the Products page and then “corian”, you are on the Products page template. When you click on the “corian” breadcrumb, you are taken to the default page template.

What you want to do is very simple – suggest you start with everything on the Products or default page and add as you go.

Offline

#7 2008-12-29 21:52:32

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

Re: trouble with if_section and if_category

if I click on “products” then on say “corian” I get the page I want, but the gallery with all the corian colors does not show up.

What code are you using to display the link to those category pages?

Also you can trim your code a bit, this will do the same as the code you posted:

<txp:if_section name="products" />
     <txp:article_custom section="products" form="products" limit="1" />
     <txp:if_category name="corian,granite,zodiac">
          <txp:article />
          <txp:wow_gallery name='<txp:category />' rows="4" cols="6" captions="1" browse="1" />
     </txp:if_category>
</txp:if_section>

Offline

#8 2008-12-29 21:54:08

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

Re: trouble with if_section and if_category

You also seem to have some issues with the wow_image plugin. I have never used the plugin, so can’t help you there.

Textpattern is very logical, whatever it displays is exactly what you tell it to. That’s why I suggest you start with figuring out your default page content (where categories should display for example) and build gradually.

Offline

#9 2008-12-29 21:55:31

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

Re: trouble with if_section and if_category

Nice code from Els. Note that for it to work, you need at least TXP 4.07.

Offline

#10 2008-12-29 22:02:25

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

Re: trouble with if_section and if_category

Have a look at your source code, you have a whole bunch of html code after the </html> tag!

Offline

#11 2008-12-30 03:35:22

stormga
Member
Registered: 2008-12-11
Posts: 11

Re: trouble with if_section and if_category

Thanks! I can see what you mean by all the extra code. I did clean it up, and I have used your code, Els, but I am still not getting it to not display the home page content when I want the category to display Here is what I have on my default page:
<code><txp:output_form form=“meta” />
<txp:output_form form=“header+nav” />
<txp:output_form form=“leftflr” />
<txp:if_section name=“default”> <txp:article_custom section=“home” form=“home_content”
limit=“1” />

</txp:if_section>

<txp:if_section name=“products” /> <txp:article_custom section=“products” form=“products” limit=“1” /> <txp:if_category name=“corian,granite,zodiac”> <txp:article /> <txp:wow_gallery name=’<txp:category />’ rows=“4” cols=“6” captions=“1” browse=“1” /> </txp:if_category>
</txp:if_section>

<div id=“right_flr”></div> <div id=“clear”></div>
<div id=“footer”> <p>Copyright © 2008 Metro Stone Works. 9115 Digital Drive, Unit 12 Manassas Park, VA 201111 </p> <p>Site Design by Storm Graphic Arts</p> </div>
</div>
</body>
</html></code>

I have checked the forms and there are no more </html> in there, and yes, I do have 4.0.7 installed…. actually, on 4.0.6 it behaved a bit better, but I knew I should upgrade the site while I was still fighting the good fight here.

Thanks again!

Offline

#12 2008-12-30 07:26:00

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

Re: trouble with if_section and if_category

You are not calling any categories from the default page, only from the products page. Does the products page template use the default page? (assigned in the sections tab)

If your categories need to display on the home page (default page), then remove the if_section name="products" conditional.

Offline

Board footer

Powered by FluxBB