Scott87 Posted February 6, 2009 Share Posted February 6, 2009 the *insert thing*? Just kidding I'm having a bit of a struggle coming up with a solution - it's probably a simple thing and i'm just totally useless and should know better but basically this is it: I've got a site which is ran through a CMS, the CMS generates pages from the index.php template. I want to change a few things on some pages. E.g. I have a right 'Facts box' on the index.php (which obviously displays on every page due to the template). However on the contact page I want an image to display here in place of the facts box. Any ideas? Thanks in advance..... Quote Link to comment Share on other sites More sharing options...
gevans Posted February 6, 2009 Share Posted February 6, 2009 Use the same identifier that the template uses to display the correct page; if(THEPAGE == CONTACT){ //show image } else { //stick with the facts box } Quote Link to comment Share on other sites More sharing options...
Scott87 Posted February 6, 2009 Author Share Posted February 6, 2009 At the moment i'm doing it by saying : <?php if($page == 'contact-us'){ include('_inc/rightsection2.inc.php'); } ?> <?php if($page == 'login'){ include('_inc/rightsection2.inc.php'); } ?> <?php if($page == 'faqs'){ include('_inc/rightsection2.inc.php'); } ?> <?php include('_inc/rightsection.inc.php') ?> In rightsection2.inc.php I have an include along with some other xhtml stuff. The include is to rightbox.inc.php which has: <?php $rightbox = array( 'faqs' => '_img/faqanswers.jpg', 'contact-us' => '_img/contactsuccessful.jpg', 'login' => '_img/loginexperience.jpg', ); $page = isset($_GET['page']) ? $_GET['page'] : 'home'; // default to home page echo "<img src=\"{$rightbox[$page]}\" />"; ?> The images are working fine, however i still have the normal include of: <?php include('_inc/rightsection.inc.php') ?> Being displayed, I need to show it on all pages except the contact-us - faqs and login area. If i can hide this include only on those three pages everything should work fine. Quote Link to comment Share on other sites More sharing options...
Scott87 Posted February 6, 2009 Author Share Posted February 6, 2009 Alright cheers, i'll have a go. Quote Link to comment Share on other sites More sharing options...
gevans Posted February 6, 2009 Share Posted February 6, 2009 <?php $pages = array('contact-us','login','faqs'); if(in_array($page, $pages)){ include('_inc/rightsection2.inc.php'); } else { include('_inc/rightsection.inc.php'); } ?> Quote Link to comment Share on other sites More sharing options...
Scott87 Posted February 6, 2009 Author Share Posted February 6, 2009 Thanks for that. if($page == 'contact-us','login','faqs'){ //show righthand images include('_inc/rightsection2.inc.php'); } else { //use the facts box include('_inc/rightsection.inc.php') } Didn't work but Gevans code did, thanks again. Scott Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.