• 0

layout changeing


Question

say i have my layout (all html/images) and were i want the menu i put $menu and where i want content i put $content ect

now how can i go index.php?section=downloads

and it loads the template and replaces the $menu/$content with what i put in a file

see what im trying to do is be able to change my layout but not have to trandsfer my content to the new layout ;)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

<?
global $section;

$header = "/path/to/header";
$footer = "/path/to/footer";
$menu = "/path/to/menu";
$main_content = "/path/to/main/content";
$downloads_content = "/path/to/downloads/content";

include $header;
include $menu;

if($section){
if($section == "main"){
include $main_content;
}elseif($section == "downloads"){
include $download_content;
}else{
echo "Page with no selction defined";
}
}else{
echo "Page without section";
}

include $footer;
?>

is that what you want?

Edited by mikey
Link to comment
Share on other sites

  • 0

ok, well use the same code, but instead of include(), just set the variables, then put the html after it, echoing the variables when they are required.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.