Rusty.Metal Posted April 9, 2003 Share Posted April 9, 2003 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 More sharing options...
0 mikey Posted April 9, 2003 Share Posted April 9, 2003 (edited) <? 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 April 9, 2003 by mikey Link to comment Share on other sites More sharing options...
0 Rusty.Metal Posted April 9, 2003 Author Share Posted April 9, 2003 sort of...well see i want to make the html and then put the $menu,$content and it automaticly replaces them Link to comment Share on other sites More sharing options...
0 mikey Posted April 11, 2003 Share Posted April 11, 2003 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 More sharing options...
Question
Rusty.Metal
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