Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Customizing a single page or category

Customizing a single page or category

Views: 1,198

Results 1 to 12 of 12
17 Jan 2011, 4:14 PM
#1
first_action avatar

first_action

New Zenner

Join Date:
Jan 2010
Posts:
16
Plugin Contributions:
0

Customizing a single page or category

I have put social networking icons at the top of every page in my zen shop, but I have a 'hidden' category which i dont want users to be able to easily share. Is it possible to remove them just from that category?

My site is
http://www.firstactionarticles.com/highly_recommended/

The hidden category is located at http://firstactionarticles.com/highly_recommended/index.php?main_page=index&cPath=48

Thanks

17 Jan 2011, 4:59 PM
#2
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Customizing a single page or category

First Action:

I have put social networking icons at the top of every page in my zen shop, but I have a 'hidden' category which i dont want users to be able to easily share. Is it possible to remove them just from that category?

My site is
http://www.firstactionarticles.com/highly_recommended/

The hidden category is located at http://firstactionarticles.com/highly_recommended/index.php?main_page=index&cPath=48

Thanks

You can enclose the code that handles the "social networking" in a conditional statement as shown below:

<?php if (!$current_page_base == 'index' and $cPath == '48') {

<div id="bannerThree" class="banners"><center> <a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="First_Action">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <a href="http://www.facebook.com/sharer.php?u=http%3A//www.firstactionarticles.com/highly_recommended&t=First+Action+Articles" target="_blank"><img src="http://www.firstactionarticles.com/images/faceshare.jpg" alt="Share this on Facebook" width="72" height="22" border="0" /></a> <script type="text/javascript"> (function() { var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = 'http://widgets.digg.com/buttons.js'; s1.parentNode.insertBefore(s, s1); })(); </script> <!-- Compact Button --> <a class="DiggThisButton DiggCompact"></a></center> <br></div> } ?>

This will show the social networking on each page except for category 48.

22 Jan 2011, 12:59 PM
#3
first_action avatar

first_action

New Zenner

Join Date:
Jan 2010
Posts:
16
Plugin Contributions:
0

Re: Customizing a single page or category

Hi Clyde,

Thanks for your response.

Do you know which page I change this code on?

I tried just putting it in the banner box through the zen cart admin but it didnt work

I also tried copying the code into the tpl_main_page.php but that just made my site turn to white space.

Sorry for the late reply.

I dont know if it will help but when I post the code into the banner box via the admin the last bit of the added code shows up on the pages ie "} ?>"

Thanks

22 Jan 2011, 4:11 PM
#4
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Customizing a single page or category

First Action:

Hi Clyde,

Thanks for your response.

Do you know which page I change this code on?

I tried just putting it in the banner box through the zen cart admin but it didnt work

I also tried copying the code into the tpl_main_page.php but that just made my site turn to white space.

Sorry for the late reply.

I dont know if it will help but when I post the code into the banner box via the admin the last bit of the added code shows up on the pages ie "} ?>"

Thanks

Do you know which page I change this code on?

It would be the page you edited when you inserted the code. I'm guessing it was tpl_main_page.php

22 Jan 2011, 6:12 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Customizing a single page or category

Clyde's method is the tidy option.

But you could also create a category-specific stylesheet and use a {display: none} declaration on the div that contains the social networking elements.

The naming convention for these stylesheets is in a README file that accompanies the CSS files (look in the css folder).

22 Jan 2011, 6:15 PM
#6
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Customizing a single page or category

I use category-specific stylesheets HERE to give different categories different design characteristics.

23 Jan 2011, 3:56 AM
#7
first_action avatar

first_action

New Zenner

Join Date:
Jan 2010
Posts:
16
Plugin Contributions:
0

Re: Customizing a single page or category

clydejones:


Do you know which page I change this code on?

It would be the page you edited when you inserted the code. I'm guessing it was tpl_main_page.php

The problem is that I didnt actually change any code. I did it through the admin 'edit banner boxes'

I did try to change the tpl_main_page but all I got was white space.

Below is what I did

Original

<div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?>

New

<?php if (!$current_page_base == 'index' and $cPath == '48') { <div id="bannerThree" class="banners"><center> <a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="First_Action">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <a href="http://www.facebook.com/sharer.php?u=http%3A//www.firstactionarticles.com/highly_recommended&t=First+Action+Articles" target="_blank"><img src="http://www.firstactionarticles.com/images/faceshare.jpg" alt="Share this on Facebook" width="72" height="22" border="0" /></a> <script type="text/javascript"> (function() { var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = 'http://widgets.digg.com/buttons.js'; s1.parentNode.insertBefore(s, s1); })(); </script> <!-- Compact Button --> <a class="DiggThisButton DiggCompact"></a></center> <br></div> } ?>

Result was that my whole site turned to white.

23 Jan 2011, 4:24 AM
#8
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Customizing a single page or category

First Action:

The problem is that I didnt actually change any code. I did it through the admin 'edit banner boxes'

I did try to change the tpl_main_page but all I got was white space.

Below is what I did

Original

<div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?>

New

<?php if (!$current_page_base == 'index' and $cPath == '48') { <div id="bannerThree" class="banners"><center> <a href="http://twitter.com/share" class="twitter-share-button" data-count="none" data-via="First_Action">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> <a href="http://www.facebook.com/sharer.php?u=http%3A//www.firstactionarticles.com/highly_recommended&t=First+Action+Articles" target="_blank"><img src="http://www.firstactionarticles.com/images/faceshare.jpg" alt="Share this on Facebook" width="72" height="22" border="0" /></a> <script type="text/javascript"> (function() { var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = 'http://widgets.digg.com/buttons.js'; s1.parentNode.insertBefore(s, s1); })(); </script> <!-- Compact Button --> <a class="DiggThisButton DiggCompact"></a></center> <br></div> } ?>

Result was that my whole site turned to white.

look in the cache folder on your server and check the error log files.

what error is being reported.

24 Jan 2011, 12:56 PM
#9
first_action avatar

first_action

New Zenner

Join Date:
Jan 2010
Posts:
16
Plugin Contributions:
0

Re: Customizing a single page or category

I tried it again just now. It still didnt work but showed no error in the logs but I looked back a couple of days and found this

[22-Jan-2011 06:56:23] PHP Parse error: syntax error, unexpected '<' in /home/firstac5/public_html/highly_recommended/includes/templates/template_default/common/tpl_main_page.php on line 109

Thanks

24 Jan 2011, 1:29 PM
#10
gjh42 avatar

gjh42

Black Belt

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

Re: Customizing a single page or category

You need to close the PHP before the HTML content and reopen the PHP after it:
(original:)

<div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } ?>

(new:)

<?php if (!($current_page_base == 'index' and $cPath == '48')) {?>

<div id="bannerThree" class="banners"><?php echo zen_display_banner('static', $banner); ?></div> <?php } } } ?>
24 Jan 2011, 1:43 PM
#11
first_action avatar

first_action

New Zenner

Join Date:
Jan 2010
Posts:
16
Plugin Contributions:
0

Re: Customizing a single page or category

Well its getting closer...

It works but leaves a

} } ?>

trail on all pages, including the 'hidden' pages.

Ive left it on there so you can see what I mean

Thanks

24 Jan 2011, 1:46 PM
#12
first_action avatar

first_action

New Zenner

Join Date:
Jan 2010
Posts:
16
Plugin Contributions:
0

Re: Customizing a single page or category

Nevermind,

I just deleted that trail from the code and seems to be working fine
:clap:

Thanks heaps for all your help guys.