Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Hide an infobox on Home index.php page only


lindsayanng

Recommended Posts

Ok. I have two infoboxes on my left column that I would like to show on ALL pages except the initial home page (index.php) This means that I would like it to show on pages that are created within the index.php like the product listing pages, just not on the home page.

 

Currently I have my code here:

if ( basename($PHP_SELF) == FILENAME_DEFAULT ) { ?>
<div></div>
<?php
}else{

?>


<div class="infoboxCAT">
<?php
echo tep_display_banner('dynamic', 'sidebar');
?>
</div>
<div class="infoboxCAT">
<?php
echo tep_display_banner('dynamic', 'sidebar2');
?>
</div>
<?php } ?>

 

This code hides it on the index.php page but does not account for the pages within that page. How do I tell it to ONLY allow for index.php and nothing else

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

yea, thats the part I am having problems with. Checking if the cpath is "empty"

 

this doesn't work

 

if ( basename($PHP_SELF) == FILENAME_DEFAULT && empty($cpath) ) { ?>

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Ok. I have two infoboxes on my left column that I would like to show on ALL pages except the initial home page

Are these infoboxes that you are bringing in via the left_collumn.php? Try something like this in left_column.php

 if (basename($PHP_SELF) == FILENAME_DEFAULT) {
   if ((!empty($cPath)) || (isset($_GET['manufacturers_id']))) {
     require(DIR_WS_BOXES . your_box.php');
     require(DIR_WS_BOXES . your_box.php');
}
 } else {
   require(DIR_WS_BOXES . your_box.php');
   require(DIR_WS_BOXES . your_box.php');
 }

Notice the check for the manufacturers_id. That makes sure to bring them in if chosing a manufacturer from the drop down menu.

Link to comment
Share on other sites

Actually I just figured it out. I had been looking at the manufacturers code to just see if i can learn from it, but unfortunately i didn't need it to be that specific - it had NOTHING to do with the product info / name / id or even the actual category. I just needed it to know that if i got off of the home index.php to add that box, otherwise remove it

 

So i FIGURED IT OUT!!!

 

if ( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath==null) {

 

That code says "if you are on the home page and the category is null, display "this"

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

  • 2 months later...

Actually I just figured it out. I had been looking at the manufacturers code to just see if i can learn from it, but unfortunately i didn't need it to be that specific - it had NOTHING to do with the product info / name / id or even the actual category. I just needed it to know that if i got off of the home index.php to add that box, otherwise remove it

 

So i FIGURED IT OUT!!!

 

if ( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath==null) {

 

That code says "if you are on the home page and the category is null, display "this"

 

 

I had used this code to remove the left column from my home page 8)

<?php  if ( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath==null) {} else { ?>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<?php } ?>

 

 

Unfortunately when i click on a manufacturer the left column disappears as well. Is there any way to alter the code so this doesn't happen?

 

Kurt

Link to comment
Share on other sites

Change this:

 

<?php  if ( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath==null) {} else { ?> 

 

To this:

 

<?php  if ( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath==null && ( !isset($HTTP_GET_VARS['manufacturers_id']) ) ) {} else { ?> 

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

Change this:

 

<?php  if ( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath==null) {} else { ?> 

 

To this:

 

<?php  if ( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath==null && ( !isset($HTTP_GET_VARS['manufacturers_id']) ) ) {} else { ?> 

 

I figured it out but your awesome anyway!

Thanx!!

 

Kurt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...