Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

different header for index page and categories page


natashome

Recommended Posts

hi

 

is there a way to have 1 header for the index page and a different header for the page when you click a category?

i saw that the same index page administrates the 2 different "pages" as well.

 

thanks

/catalog/includes/header.php

 

Replace:

 

    <td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME) . '</a>'; ?></td>

With:

 

<?php
 if ( basename($PHP_SELF) == FILENAME_DEFAULT ) {
   if ( $cPath!='' )
     $image = 'categories.jpg'; // categories image here
   else
     $image = 'index.jpg'; // index page image here
 }
 else
   $image = 'index.jpg'; // image for all other pages here
?>

   <td valign="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . $image, STORE_NAME) . '</a>'; ?></td>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

thanks a lot for your reply. tried that but it does not display them, not even the missing image placeholders in ie8

I took the code right off a working site.

 

All I changed were the image names.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

oh..i now saw the $image in the row...it works yes...but...is there any way to have that image as a background? kind of like having a different background image header for the mentioned pages?

thanks again

I assume you'd want it as a background to the entire table in the header.

 

If so can you post the <table> statement that precedes the code we just modified.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

hmm...you know what i was thinking at...maybe i can put a different header file for the following files:

1. index.php

2. index.php (categories pages)

 

i only have about 10 categories and i found a piece of code on google

 

<?php
 if ($current_category_id == '82')
   {
       require(DIR_WS_INCLUDES . 'header_ku.php');
   }
   else
   {
       require(DIR_WS_INCLUDES . 'header.php');
   }
?>

 

maybe i can get a hand to tweak this since i have the SEO urls and i don't have the categories id anymore in the URL

Link to comment
Share on other sites

ok this is how i did it using your code and the one i found too

 

<?php
 if ( basename($PHP_SELF) == FILENAME_DEFAULT ) {
   if ( $cPath!='' )


       require(DIR_WS_INCLUDES . 'header3.php');

   else

       require(DIR_WS_INCLUDES . 'header2.php');
    }
 else
require(DIR_WS_INCLUDES . 'header3.php');

?>

 

works great...thanks a lot for your help

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...