Forums / Templates, Stylesheets, Page Layout / Hiding a portion of text on one category

Hiding a portion of text on one category

Locked

Views: 819

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
1 Jul 2010, 10:31 PM
#1
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Hiding a portion of text on one category

It's been a mighty long time since I have had to post a question, but a PHP coder I am definitely not so here we go...

I have a portion of text (sizing information) on a site which I have "coded" into the tpl_product_info_display.php which is working perfect because we want this info to show on all products... until now.

Now we have added a new category of product which doesn't need that extra text and I would like to hide it on that specific category only.

I know this can be achieved with an "if" statement, my problem is that I am apparently not writing the "if" statement correctly. Can someone please tell me the correct way to write the code.:unsure:

Thanks!

When the world gets in my face I say Have A Nice Day.

2 Jul 2010, 1:47 AM
#3
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: Hiding a portion of text on one category

:frusty::frusty::frusty:

That didn't work either... I had tried using the code for hiding columns from tpl_main_page and that didn't do it either.

I am thinking that it might have something to do with either the length of the text that I am putting there or maybe I need to escape some characters, because I get a blank page completely when I put the "if" in...

I will look closer at it and see if I can get it to work through some miracle.

Thanks Glen!

When the world gets in my face I say Have A Nice Day.

2 Jul 2010, 4:31 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hiding a portion of text on one category

Try the if test with a simple text output inside the switched area, to see if it is the test or the output causing the problem.

Post the text you are trying to use (exactly as it is in the code) so we can see if there are any problem characters.

2 Jul 2010, 4:55 AM
#5
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: Hiding a portion of text on one category

Good Idea Glenn - unfortunately the test shows that it is the code itself. When I add this :

<?php
if($_GET['cPath'] != '19') {

TESTING THIS TO SEE WHERE ERROR IS
}  
?>

I get a blank page for the product description. It loads as far as breadcrumbs and then goes blank :frusty:

When the world gets in my face I say Have A Nice Day.

2 Jul 2010, 5:07 AM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hiding a portion of text on one category

You need to either go back to HTML or use a PHP echo statement for the text:```php

<?php if($_GET['cPath'] != '19') { echo 'TESTING THIS TO SEE WHERE ERROR IS'; } ?>

orphp

<?php if($_GET['cPath'] != '19') { ?>

TESTING THIS TO SEE WHERE ERROR IS

<?php } ?>
2 Jul 2010, 5:17 AM
#7
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: Hiding a portion of text on one category

OK - we got the page back while it is wrapped in the if statement.

Only problem now is that it still shows on all products pages.

In this case I need it to either show only on cpath=19 or I need it to not show on cpath=23 - either way doesn't matter to me :)

When the world gets in my face I say Have A Nice Day.

2 Jul 2010, 5:37 AM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Hiding a portion of text on one category

The test as written should hide the content on category 19. Add this just above the if line to see what the actual cPath is in each case:

echo 'cPath ' . $_GET['cPath'];
2 Jul 2010, 9:15 PM
#9
tinas avatar

tinas

Totally Zenned

Join Date:
Jan 2005
Location:
Lake Havasu, AZ
Posts:
1,090
Plugin Contributions:
0

Re: Hiding a portion of text on one category

:clap::clap::clap:

Thank you very very much Glen!

Works like a champ :)

When the world gets in my face I say Have A Nice Day.