Jump to content

Recommended Posts

I making a php website and i was going to use framesets for the layout but then i decided not to so i say that some sites use some sort of layout also like framesets but its not! So i want to make my site index url like index.php?page=news and in the index have it get the $page variable and include news.php there! It does include it but when i interact with the new page i goes to the new.php page and then my menu and banner is not shown!

 

Is there anyway to fix this or do php have its own frameset like scripts avaliable?

 

Thanks

~birdbrain24

Link to comment
https://forums.phpfreaks.com/topic/87422-page-layout/
Share on other sites

All that it takes to accomplish what you are after is a simple understanding of includes. Something like this is what you are after:

 

<?php
// All your header code goes here

$page = isset($_GET['page']) ? $_GET['page'] : '';
switch ($page)
{
  case 'news':
    include('news.php');
    break;

  default:
    include('main.php');
}

// All your footer code goes here
?>

Link to comment
https://forums.phpfreaks.com/topic/87422-page-layout/#findComment-447131
Share on other sites

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.