Forums / Templates, Stylesheets, Page Layout / Selecting a header when when main_page=product_info

Selecting a header when when main_page=product_info

Locked

Views: 2,215

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
24 Feb 2010, 4:43 AM
#1
borillion_star avatar

borillion_star

New Zenner

Join Date:
Jan 2008
Posts:
73
Plugin Contributions:
0

Selecting a header when when main_page=product_info

Im trying to select change the header of the store when the browser in a product's info page, but it does not seem to be working the way I have it coded... I think there is something wrong with the line if (in_array($current_page_base,explode(",'product_info')) )

Thanks for helping :D

//selects products header, when products_info is called.
if (in_array($current_page_base,explode(",'product_info')) ) {
require($template->get_template_dir('tpl_product_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_product_header.php');}
else
require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');

24 Feb 2010, 6:47 AM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Selecting a header when when main_page=product_info

require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');

See the $current_page_base in the stock version of this code? This allows you to use a page-specific version of tpl_header.php without adding any code to tpl_main_page.php. Just put your custom copy of tpl_header.php in /includes/templates/your_template/product_info/, and Zen Cart will automatically use it when in the product info page.

http://www.zen-cart.com/wiki/index.php/Developers_API_Overrides

24 Feb 2010, 7:17 AM
#3
borillion_star avatar

borillion_star

New Zenner

Join Date:
Jan 2008
Posts:
73
Plugin Contributions:
0

Re: Selecting a header when when main_page=product_info

Thank you Glennn!!

24 Feb 2010, 9:25 PM
#4
borillion_star avatar

borillion_star

New Zenner

Join Date:
Jan 2008
Posts:
73
Plugin Contributions:
0

Re: Selecting a header when when main_page=product_info

Do I put the CSS for this new header in along with it?
Its not going to over ride the main page correct?

24 Feb 2010, 9:49 PM
#5
borillion_star avatar

borillion_star

New Zenner

Join Date:
Jan 2008
Posts:
73
Plugin Contributions:
0

Re: Selecting a header when when main_page=product_info

When create and add a new css style it overrides everything on the page, and everything gets un-styled. Is there way to tell it to inherit un-defined styles?

#logo {
float:left;
}

24 Feb 2010, 10:26 PM
#6
gjh42 avatar

gjh42

Black Belt

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

Re: Selecting a header when when main_page=product_info

Where are you adding the new style? You would want a page-specific stylesheet to hold styling that applies only to the product info page:

product_info.css

with content

#logo {
float:left;
}

Save it in your template's /css/ folder.
All styles not defined here will remain as set in stylesheet.css.

25 Feb 2010, 2:45 AM
#7
borillion_star avatar

borillion_star

New Zenner

Join Date:
Jan 2008
Posts:
73
Plugin Contributions:
0

Re: Selecting a header when when main_page=product_info

Was naming it stylesheet.CSS and putting it in with the header in /product_info/
Posted via Mobile Device

25 Feb 2010, 6:27 AM
#8
borillion_star avatar

borillion_star

New Zenner

Join Date:
Jan 2008
Posts:
73
Plugin Contributions:
0

Re: Selecting a header when when main_page=product_info

Something is broken here:
I created a file /products_info/stylesheet.css
put inside it:

#logo{
float:left;
}

and......

With CSS in /products_info/

Without CSS

25 Feb 2010, 7:26 AM
#9
gjh42 avatar

gjh42

Black Belt

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

Re: Selecting a header when when main_page=product_info

Stylesheets do not go in /product_info/.

product_info.css

with content

#logo {
float:left;
}

Save it in your template's /css/ folder.

8 Mar 2010, 12:26 AM
#10
amirgtr avatar

amirgtr

New Zenner

Join Date:
Mar 2009
Posts:
45
Plugin Contributions:
0

Re: Selecting a header when when main_page=product_info

I thought we'll be trying Magento out instead?