DeadDude Posted May 27, 2007 Share Posted May 27, 2007 i am trying to make a homepage in PHP but something along the same lines as the frames that you can use in HTML, so it allows you to have the different frames for opening different pages, but i was wondering how i would do that within PHP cheers in advance James Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/ Share on other sites More sharing options...
chronister Posted May 27, 2007 Share Posted May 27, 2007 Frames are terrible. They are cumbersome to use and they make bookmarking pages damn near impossible (for the average user.) Are you wanting to use a templated page? Where all content opens in a particular spot and your header / menu sections stay the same? Is this what your after? Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/#findComment-262770 Share on other sites More sharing options...
DeadDude Posted May 27, 2007 Author Share Posted May 27, 2007 something like that yeah i have a logo which i always want to stay at the top i have links on the index page, but when i click a couple of them i want them to load up where the original ones were and the rest of the pages i want to load up in a seperate area, which in the frames would be the mainframe Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/#findComment-262771 Share on other sites More sharing options...
gabeg Posted May 27, 2007 Share Posted May 27, 2007 Depending on the complexity.... this can be your template <?php function top($links) { echo "header stuff"; if($links == 1) { echo "links to show"; }elseif($links == 2) echo "links to show"; } } function bottom() { echo "© 2007 Whatever"; } now any file you have do this <?php include("template.php"); //change the 1 to 2, if you want to display something different at the top. top("1"); echo "this is the body of the page"; bottom(); ?> since youre just getting started, this should help you out somewhat Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/#findComment-262774 Share on other sites More sharing options...
chronister Posted May 27, 2007 Share Posted May 27, 2007 Here is how I do the template thing. header.php <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> </head> <body> <!-- All Content Loads Here --> <?php function footer(){ ?> </body> </html> <?php } ?> Other pages <?php include('header.php') ?> some content some more content <?php footer() ?> THis is a crude example, but it is the same principle. The header.php page wraps around the other pages by way of the include and by making the lower part of code a footer function. I use table layouts still, and I incorporate this inside the tables so one particular cell is where all my code loads up at. And by doing this you can simply make links to all your css, and other items you want included in all pages. Hope this helps, Nate Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/#findComment-262797 Share on other sites More sharing options...
DeadDude Posted May 27, 2007 Author Share Posted May 27, 2007 i have some files that would incorporate stuff like that, the index is using tables and using the include but i cnt work out how to load the other pages in the individual parts of the table Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/#findComment-262810 Share on other sites More sharing options...
gabeg Posted May 27, 2007 Share Posted May 27, 2007 i have some files that would incorporate stuff like that, the index is using tables and using the include but i cnt work out how to load the other pages in the individual parts of the table not sure what you're trying to do..can you explain a little more Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/#findComment-262812 Share on other sites More sharing options...
chronister Posted May 27, 2007 Share Posted May 27, 2007 You need to load even the index page inside the table. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> </head> <body> <table width="100%" cellpadding="0" cellspacing="0"> <tr colspan="2"><td>Banner Goes Here</td></tr> <tr><td>Menu Here</td> <td> <!-- All Content Loads Here --> <?php function footer(){ ?> </td> </tr> <tr><td colspan="2">FOOTER HERE</td></tr> </table> </body> </html> <?php } ?> I am not using my normal methods of writing this, so I may have made a typo or 2. Call this page header.php or whatever you want, and then call it like I showed you earlier. Then your index.php and all other pages will be loaded in content cell. This table layout produces a 3 row 2 column table. Header Menu Content Footer Everything will load in the spot marked content. Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/#findComment-262882 Share on other sites More sharing options...
DeadDude Posted May 28, 2007 Author Share Posted May 28, 2007 cheers for all the help Quote Link to comment https://forums.phpfreaks.com/topic/53188-web-pages/#findComment-263473 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.