Jump to content

Page Layout?


birdbrain24

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

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.