Jump to content

if equals home show this page


Exact

Recommended Posts

hey guys,

 

when people go to the home page i want it to show a middle file called middle.php, any other page, i want it to not show up.

 

This code doesnt seem to show the middle.php, leaves it out completely:

 

<?php if ($page != 'home' && $page != '') include('middle.php');?>

 

can anyone see anything wrong with the above code?

Link to comment
https://forums.phpfreaks.com/topic/183352-if-equals-home-show-this-page/
Share on other sites

neither of those scripts seem to pull it. would my other code be clashing with it? this script is in another file, but this wouldnt be stopping it would it?

 

<?php $files = glob('*.php'); if (isset($_GET['page'])) 
{   foreach ($files as $file) {          if (strtolower($_GET['page']) . ".php" == $file) {                  include($file);          }   }} else { include 'home.php'; }
?>

<?php 
$files = glob('*.php'); 
if (isset($_GET['page'])) {
foreach ($files as $file) {
if (strtolower($_GET['page']) . ".php" == $file) {
include($file);
//include middle
if (strtolower($_GET['page']) . ".php" == "home"){ include("middle.php"); }      
}//end if
}//end foreach
}//end if
else {
include 'home.php'; 
include "middle.php";
}
?>

 

something like that is probably what you want to do

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.