toolman Posted February 5, 2010 Share Posted February 5, 2010 Hi I have a template that displays a left sidebar on all pages. However, I don't want it to display on the homepage (index.php) Is there a way I can make not show on the homepage? I was thinking something like if(homepage){ echo nothing } else{ echo sidebar} would something like that work? Thanks Link to comment https://forums.phpfreaks.com/topic/191084-exclude-content-from-homepage/ Share on other sites More sharing options...
alhen Posted February 5, 2010 Share Posted February 5, 2010 can you include the code from the homepage that is calling the sidebar? Link to comment https://forums.phpfreaks.com/topic/191084-exclude-content-from-homepage/#findComment-1007570 Share on other sites More sharing options...
toolman Posted February 5, 2010 Author Share Posted February 5, 2010 Sure: <div id="left"> <?php include("sidebarleft.php"); ?> </div> Link to comment https://forums.phpfreaks.com/topic/191084-exclude-content-from-homepage/#findComment-1007581 Share on other sites More sharing options...
teamatomic Posted February 5, 2010 Share Posted February 5, 2010 If your index is not a controller page then $page = basename($_SERVER['PHP_SELF']); if ($page == 'index.php'){include("sidebarleft.php");} if your index is a controller page then you already have the pagename as a var so just use the var and the if statement above. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/191084-exclude-content-from-homepage/#findComment-1007591 Share on other sites More sharing options...
toolman Posted February 5, 2010 Author Share Posted February 5, 2010 Thanks very much! I think it works, but I have just realised something.. all my pages are using index.php?... I guess i will need to go back to the drawing board Link to comment https://forums.phpfreaks.com/topic/191084-exclude-content-from-homepage/#findComment-1007600 Share on other sites More sharing options...
toolman Posted February 5, 2010 Author Share Posted February 5, 2010 I managed to work it out. I used: <?php if($xview !== "main"){ Link to comment https://forums.phpfreaks.com/topic/191084-exclude-content-from-homepage/#findComment-1007605 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.