Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-12-30 18:35:50

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

Re: trouble with if_section and if_category

Yes, the products page uses the default page, as does the home page. I do not want the categories to show up on the products page, only on the products page (and other pages as well later on) What I want to happen is for the home page content to appear on the default page when the site is accesses, when the products page is accessed, I would like what is currently displayed on the products page to be just as it is (except I need to fix the rightflr to show up, but that is minor and not the problem right now) and then when one of the categories is clicked on, the only think that changes on the products page is that the gallery shows up in the empty space to the left of the “edges” image. This image would change based on which category is selected… Does that make sense?

I do not understand where all the extra code is coming from – I do not even see the </html> in there.. it is odd.

Thanks!

Offline

#14 2008-12-30 18:50:51

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

Re: trouble with if_section and if_category

I think I understand what you mean….!

Have you read the TextBook entry on txp:category? You can use the section="section name" attribute, perhaps like so:

<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 section="products" />’ rows=“4” cols=“6” captions=“1” browse=“1” />
</txp:if_category>
</txp:if_section>

This is the change: <txp:category section="products" />

Last edited by jstubbs (2008-12-30 18:51:27)

Offline

#15 2008-12-30 19:00:53

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

Re: trouble with if_section and if_category

ok… now I am making all of these changes to the default page… not the default form… is that correct? I have made the changes, and… well… no change.

Offline

#16 2008-12-30 19:11:24

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

Re: trouble with if_section and if_category

Yes, those changes should be in the “default” page, since you have assigned the “Products” section to use the default page.

Can we make sure that the code works – please place some test material:

<txp:if_category name="corian,granite,zodiac">
This is a category page, displaying on the products page
<txp:else />
We are in a non-category page
</txp:if_category>

Please try that first, because then you know if you are on the right track or not,

If that works, please check if wow_gallery is your problem. Having not used it, I can’t say, but you may want to add this to the category call:

<txp:wow_gallery name=’<txp:category section="products" type="image" />’ rows="4" cols="6" captions="1" browse="1" />

Not sure if the type=“image” attribute is required, because the default is type=“article”. Depends on wow_gallery.

Last edited by jstubbs (2008-12-30 21:43:41)

Offline

#17 2008-12-30 21:38:37

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

Re: trouble with if_section and if_category

If you are copying Jonathan’s code, you’ll have to change the quotes! Make sure there are no curly quotes in the code, just ' and ".

Offline

#18 2008-12-30 21:44:06

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

Re: trouble with if_section and if_category

Mmm. Copied the code from further up the thread ;-) Edited the post, should be ok now.

Last edited by jstubbs (2008-12-30 21:44:22)

Offline

#19 2008-12-31 06:13:26

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

Re: trouble with if_section and if_category

Thanks!
Well, I put that in the code and the text “this is in a non-category page” came up on the home page (at the bottom) plus the products page and the category page…
<code>
<txp:if_section name=“products” /> <txp:article_custom section=“products” form=“products” limit=“1” /> <txp:if_category name=“corian,granite,zodiac”> This is a category page, displaying on the products page <txp:else />
We are in a non-category page </txp:if_category>
</txp:if_section>
</code>

Offline

#20 2008-12-31 06:14:26

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

Re: trouble with if_section and if_category

and I do have the straight “ and ‘ in the code… even though it comes out as the curly quotes in my post.

Thanks!

Offline

#21 2008-12-31 06:18:30

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

Re: trouble with if_section and if_category

ok, I just noticed that I had that /> behind the <txp:if_section name=“products”> again… I did fix that and got the home page to look perfect. Yea! progress!

the rightflr is now in the wrong place… I think I can fix that…

but the category page is still displaying the same as the products page with “We are in a non-category page” on it.

I do like progress, though!

Offline

#22 2008-12-31 15:48:35

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

Re: trouble with if_section and if_category

Just a guess: your using capitals in category names might have something to do with this. Change all category (and section, if any) names to all lowercase, and see if it makes a difference.

(You will see that the results on /products/?c=corian are different from /products/?c=Corian.)

Last edited by els (2008-12-31 15:51:55)

Offline

#23 2008-12-31 16:26:24

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

Re: trouble with if_section and if_category

Yea, I fixed that just now… thanks.

Offline

#24 2009-01-01 19:06:57

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

Re: trouble with if_section and if_category

Thank you all for your help. my friend John came and helped me get it all fixed. here is the final fix in case it can help others:
<code>
<div id=“content”> <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” status= “sticky” limit=“1” /> <div class=“cat_nav”> <txp:category_list section=“products” categories=“corian,granite,zodiaq” wraptag=“ul” break=“li” /></div> <txp:if_category> <txp:article /> <txp:wow_gallery name=’<txp:category />’ rows=“3” cols=“6” captions=“1” browse=“1” /> <txp:else /> </txp:if_category> </txp:if_section> </div><!—end content—> <div id=“right_flr”></div> </div> </code>

Offline

Board footer

Powered by FluxBB