Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Different Header for contact page?

Different Header for contact page?

Views: 6,586

Results 21 to 30 of 30
18 Oct 2011, 6:55 PM
#21
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Different Header for contact page?

moesoap:

I have tried this but cannot get it to work

if ($current_page_base == 'main_page=document_product_info' and $cPath=='123' and $products_id=='229') {
require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');
}
else
require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');?>

> 
> :unsure:

^^bump^^ Anyone?
19 Oct 2011, 4:25 AM
#22
gjh42 avatar

gjh42

Black Belt

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

Re: Different Header for contact page?

Don't be so impatient - it can sometimes be a day before someone who knows your answer sees the thread.

You don't test for $current_page_base to be 'main_page=document_product_info', you test for 'document_product_info', similar to other page tests described.```php
if ($current_page_base == 'document_product_info' and $cPath=='123' and $products_id=='229') {

19 Oct 2011, 8:33 AM
#23
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Different Header for contact page?

gjh42:

Don't be so impatient - it can sometimes be a day before someone who knows your answer sees the thread.

You don't test for $current_page_base to be 'main_page=document_product_info', you test for 'document_product_info', similar to other page tests described.```php
if ($current_page_base == 'document_product_info' and $cPath=='123' and $products_id=='229') {


Thankyou for replying. I tried what you suggested and it didn't work. The code i used was - 

```php
<?php
 /**
  * prepares and displays header output
  *
  */
  if ($current_page_base == 'cuzhy_clothing' or 'document_product_info' and $cPath=='123' and $products_id=='229') {
require($template->get_template_dir('tpl_header2.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header2.php');
}
else
require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');?>

The first section worked. However the product_info page did not?

19 Oct 2011, 9:46 AM
#24
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Different Header for contact page?

gjh42:

Don't be so impatient - it can sometimes be a day before someone who knows your answer sees the thread.

You don't test for $current_page_base to be 'main_page=document_product_info', you test for 'document_product_info', similar to other page tests described.```php
if ($current_page_base == 'document_product_info' and $cPath=='123' and $products_id=='229') {


Got this to work with 'document_product_info' selected only. It won't work with the rest of the code, i.e. cpath and products id.

However this is sufficient for me.

Thanks gjh42 for your help.
19 Oct 2011, 9:55 AM
#25
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Different Header for contact page?

moesoap:

Got this to work with 'document_product_info' selected only. It won't work with the rest of the code, i.e. cpath and products id.

However this is sufficient for me.

Thanks gjh42 for your help.

Forget that, that solution changed all the headers. :(

19 Oct 2011, 1:05 PM
#26
gjh42 avatar

gjh42

Black Belt

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

Re: Different Header for contact page?

  if ($current_page_base == 'cuzhy_clothing' or 'document_product_info' and $cPath=='123' and $products_id=='229') {
```You didn't mention that you had multiple page base tests going on. You should use parentheses to ensure that the tests are grouped as you intend. The above won't test for $current_page_base == 'document_product_info'; to be certain, you need to state it as```php
  if ($current_page_base == 'cuzhy_clothing' or ($current_page_base == 'document_product_info' and $cPath=='123' and $products_id=='229')) {
19 Oct 2011, 1:21 PM
#27
moesoap avatar

moesoap

Zen Follower

Join Date:
Mar 2010
Posts:
258
Plugin Contributions:
0

Re: Different Header for contact page?

gjh42:

if ($current_page_base == 'cuzhy_clothing' or 'document_product_info' and $cPath=='123' and $products_id=='229') {
You didn't mention that you had multiple page base tests going on. You should use parentheses to ensure that the tests are grouped as you intend. The above won't test for $current_page_base == 'document_product_info'; to be certain, you need to state it asphp
if ($current_page_base == 'cuzhy_clothing' or ($current_page_base == 'document_product_info' and $cPath=='123' and $products_id=='229')) {


Thankyou gjh42. The cpath and products id didnt work, however the document_product_info did and its applying only to that and not taking over all the headers.

Thanks again.
26 Jan 2012, 6:03 PM
#28
dreamoutlaw avatar

dreamoutlaw

New Zenner

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

Re: Different Header for contact page?

I used Glen's code for my home page, and it works perfectly. But, I want to do the same for a couple of ez pages. Seems to me we should be able to insert an 'elseif' statement in there somewhere to include ezpage_id numbers. I tried the 'array' statement above, but couldn't get it to work. Any suggestions?

26 Jan 2012, 9:09 PM
#29
dreamoutlaw avatar

dreamoutlaw

New Zenner

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

Re: Different Header for contact page?

I think I'm looking for something like the following, but I don't know how to write it:

if ($this_is_home_page) {
	require($template->get_template_dir('tpl_header_home.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header_home.php');}
elseif ($ezpage_id=="15") {
	require($template->get_template_dir('tpl_header_home.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header_home.php');}	
else{
	require($template->get_template_dir('tpl_header.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/tpl_header.php');}

This way, my home page, as well as any number of EZ Pages could use the same header...(I think).

27 Jan 2012, 3:47 AM
#30
gjh42 avatar

gjh42

Black Belt

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

Re: Different Header for contact page?

elseif ($current_page_base == 'page' and in_array($_GET['id'], explode(',', '15,27,31,8'))) {//for ez-page ids 15,27,31 or 8