dustinsuarez Posted February 2, 2010 Share Posted February 2, 2010 If someone please could tell me how to display header banner only on homepage, I will appreciate it!! This is what I have so far: I have created a banner in a group that I named "homepage", and I also have the PHP code to be inserted: <?php if ($banner = tep_banner_exists('dynamic', 'homepage')) { echo tep_display_banner('static', $banner).tep_draw_separator('pixel_trans.gif', '100%', '6'); } ?> Now if I insert this code into the file "header.php" the banner will show in every page. But I only need the banner to be displayed on the homepage and NO banner on the rest of the pages. Any suggestions? Thanks in advance. Link to comment Share on other sites More sharing options...
Guest Posted February 2, 2010 Share Posted February 2, 2010 Dustin, You could remove <?php require(DIR_WS_INCLUDES . 'header.php'); ?> from all pages you do NOT want the header displayed on. However, the header.php file also controls account/cart contents/checkout as well as the bread crumbs so test it on one page before deleting them all. THIS MAY OR MAY NOT WORK. Chris Link to comment Share on other sites More sharing options...
dustinsuarez Posted February 2, 2010 Author Share Posted February 2, 2010 Chris, Thanks for the tip, I tried that but as you pointed the "header.php" controls more than just the banner... when I removed it from one page it removed the banner as well as the categories, logo, main menu, etc. I saw one page where the banner shows only on the homepage. The problem is that I dont remember the name of the website, nor the topic, or the name of the store owner... My PHP knowledge is very limited so I will appreciate it if you or anyone could come up with some solution... Thanks again, Link to comment Share on other sites More sharing options...
dustinsuarez Posted February 2, 2010 Author Share Posted February 2, 2010 I found the solution, I thought I posted. I might help someone with the same or similar issue. Just as in the "footer.php" file, the "header.php" file contains at the end a code where the banner is called, so it shows on every page where "footer.php" or "header.php" is required. I am going to focus on the "header.php" file for this is the one that I needed to change. I removed this code found at the end of the header.php file: <?php if ($banner = tep_banner_exists('dynamic', 'homepage')) { echo tep_display_banner('static', $banner).tep_draw_separator('pixel_trans.gif', '100%', '6'); } ?> And inserted it in the file: catalog/index.php (Because I wanted the banner to be displayed only in that page) right below this line: <?php require(DIR_WS_INCLUDES . 'header.php'); ?> That's it! **Thanks again Chris, the suggestion you made helped me come up with the solution!! Link to comment Share on other sites More sharing options...
♥mdtaylorlrim Posted February 2, 2010 Share Posted February 2, 2010 deleted Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...? Link to comment Share on other sites More sharing options...
Guest Posted February 2, 2010 Share Posted February 2, 2010 I found the solution, I thought I posted. I might help someone with the same or similar issue. Just as in the "footer.php" file, the "header.php" file contains at the end a code where the banner is called, so it shows on every page where "footer.php" or "header.php" is required. I am going to focus on the "header.php" file for this is the one that I needed to change. I removed this code found at the end of the header.php file: <?php if ($banner = tep_banner_exists('dynamic', 'homepage')) { echo tep_display_banner('static', $banner).tep_draw_separator('pixel_trans.gif', '100%', '6'); } ?> And inserted it in the file: catalog/index.php (Because I wanted the banner to be displayed only in that page) right below this line: <?php require(DIR_WS_INCLUDES . 'header.php'); ?> That's it! **Thanks again Chris, the suggestion you made helped me come up with the solution!! Another you you could have done it while leaving it in the header.php is like this <?php if (basename($PHP_SELF) == FILENAME_DEFAULT) { if ($banner = tep_banner_exists('dynamic', 'homepage')) { echo tep_display_banner('static', $banner).tep_draw_separator('pixel_trans.gif', '100%', '6'); } } ?> Link to comment Share on other sites More sharing options...
Guest Posted February 2, 2010 Share Posted February 2, 2010 no Problem Dustin, sometimes brain storming helps. Chris Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.