Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.