|
|
|
|
![]() ![]() |
Feb 21 2008, 11:09 PM
Post
#11
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 3,993 Joined: 24-July 05 From: In Trouble Again... still? Member No.: 9,787 ![]() |
Here is a link to a Tutorial or 2 over at the Astahost site which you might find helpful.
http://www.astahost.com/cms102-content-man...ign-t11367.html |
|
|
|
Feb 21 2008, 11:14 PM
Post
#12
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 416 Joined: 26-January 08 Member No.: 56,881 |
I believe I understand what you are saying... If I understand correctly: you want to have a basic template seperated from the the rest of your content, and then just parse the content into the template, or the template around the content right? If this is the case I would recommend using this. (code) After you create the above index.php file, create all your content on seperate .html files. For your links, simply use "<a href="index.php?cont=page">" Without the .html extension, as it will be placed in after the file name. That's exactly what I don't want to do. I don't want the page file to be an argument on index.php; I just want it to be a file by itself. Is that possible? |
|
|
|
Feb 21 2008, 11:17 PM
Post
#13
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 528 Joined: 13-October 06 From: Alberta, Canada Member No.: 31,584 |
So you want all of your websites content to be in a single file?
|
|
|
|
Feb 21 2008, 11:48 PM
Post
#14
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 416 Joined: 26-January 08 Member No.: 56,881 |
So you want all of your websites content to be in a single file? No, that's not what I meant. I mean that I want the container to be 1 page, and then all the other files will link to it with the PHP include. Sorry if I'm messing myself up. |
|
|
|
Feb 22 2008, 07:35 PM
Post
#15
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 528 Joined: 13-October 06 From: Alberta, Canada Member No.: 31,584 |
Ok what you could do:
Create a php file that contains the layout of your page. make it look somewhat like this (call it layout.php) CODE <?php //--------------------------------- //Layout top section //--------------------------------- $top = <<< html <!-- include HTML header code here --> <body> <table id="page" width="100%"> <tr><td> <table id="top-bar" height="148px"> <tr><td width="172px"><img src="logo.png"></td><td><!-- title --></td></tr> </table> </td></tr> <tr><td> <table id="sidebar" width="256px"> <!-- does the "width" and "height" option go into CSS? I don't remember. --> <tr style="background-image: sidebar-top.png;"><!-- link to home page --></tr> <tr style="background-image: sidebar-middle.png; background-repeat: repeat;"><!-- other links --></tr> <tr style="background-image: sidebar-bottom.png;"><!-- spotlight link: possibly to Trap17, maybe an ad or two --></tr> </table> </td><td> html; //--------------------------------- //Layout bottom section //--------------------------------- $bottom = <<< html </td></tr> </table> </body> html; ?> Ok, so in this you have two variables. The first being the 'top' part of your layout. This would be everything before your 'pure content' areas. The second variable is the 'bottom' part of your layout. This would be everything after your 'purecontent' area. So in short it would look like this. $top content $bottom Now here is where what you want comes into play. You can echo your entire layout around your content like this. CODE <html> <?php include ("layout.php"); echo $top; ?> Put your content here!!! <?php echo $bottom; ?> </html> I think this should work... maybe jlhaslip or another member more expierienced than me could point out any flaws if any... and I hope this is what you were looking for.... |
|
|
|
Feb 22 2008, 08:29 PM
Post
#16
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 416 Joined: 26-January 08 Member No.: 56,881 |
Ok what you could do: Create a php file that contains the layout of your page. make it look somewhat like this (call it layout.php) CODE <?php //--------------------------------- //Layout top section //--------------------------------- $top = <<< html <!-- include HTML header code here --> <body> <table id="page" width="100%"> <tr><td> <table id="top-bar" height="148px"> <tr><td width="172px"><img src="logo.png"></td><td><!-- title --></td></tr> </table> </td></tr> <tr><td> <table id="sidebar" width="256px"> <!-- does the "width" and "height" option go into CSS? I don't remember. --> <tr style="background-image: sidebar-top.png;"><!-- link to home page --></tr> <tr style="background-image: sidebar-middle.png; background-repeat: repeat;"><!-- other links --></tr> <tr style="background-image: sidebar-bottom.png;"><!-- spotlight link: possibly to Trap17, maybe an ad or two --></tr> </table> </td><td> html; //--------------------------------- //Layout bottom section //--------------------------------- $bottom = <<< html </td></tr> </table> </body> html; ?> Ok, so in this you have two variables. The first being the 'top' part of your layout. This would be everything before your 'pure content' areas. The second variable is the 'bottom' part of your layout. This would be everything after your 'purecontent' area. So in short it would look like this. $top content $bottom Now here is where what you want comes into play. You can echo your entire layout around your content like this. CODE <html> <?php include ("layout.php"); echo $top; ?> Put your content here!!! <?php echo $bottom; ?> </html> I think this should work... maybe jlhaslip or another member more expierienced than me could point out any flaws if any... and I hope this is what you were looking for.... Yes, this is exactly what I wanted. Thanks, Kansuke! |
|
|
|
Feb 22 2008, 08:37 PM
Post
#17
|
|
|
|||[ n00b King ]||| ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 680 Joined: 20-June 07 From: Auckland Member No.: 45,102 |
In effect what your using kansuke is a template. Thats what how I do my webpages at the moment. The only improvements that I think you can make are include the full HTML in your layout.php. That way you can contorl everything such as headings, javascripts includes, CSS. now when you need to make changes to the site you just edit the layout.php template and it will affect your whole website.
when you use it you can create a page (example.php) and pass it variable specific to that page. CODE example.php $title $content = "example_content.php" (I always do this as in include in the actual template) include('layout.php'); So first thing you would do is create a plain HTML layout you like and set where you content and items will be. Then identifiy what changes and make place holders in your template for it. Then when you are happy with it you turn it into a PHP file being the templat you will use for all your pages. Now when you need a page or extra one you just create one and pass it the variables appropriate to it. Heres an example of my index.php page CODE <?php session_start(); include('includes/db.php'); $title = "Welcome"; $location = "index.php"; $content = "includes/home_content.php"; include('_core.php'); ?> and heres my tempate CODE <?php /* Core template ============== $title include('menu_list.php'); $content */ $title = $title." - Si Web Portfolio"; echo" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\"> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" /> <title>$title</title> <script type='text/javascript' src='js/si.js'></script> <link rel=\"stylesheet\" type=\"text/css\" href=\"main.css\" /> </head> <body> <!-- Begin Wrapper --> <div id=\"wrapper\"> <!-- Begin Header --> <div id=\"header\"> <div id=\"header_leftside\"></div> <div id=\"header_rightside\"></div> <div id=\"header_center\"> <div id=\"header_logo\"></div> </div> </div> <!-- End Header --> <!-- Begin sub_heading --> <div class=\"container\"> <div id=\"sh_center\"> <div id=\"sh_block\"> <img src=\"images/si_15.png\" alt=\"\" /> </div> </div> <div id=\"sh_left\"></div> <div id=\"sh_right\"></div> </div> <!-- End sub_heading --> <!-- MAIN CONTENT --> <div id=\"content_container\"> <div id=\"leftsidebar\" class=\"leftbar\"> <div id=\"left_nav_container\"> <ul class=\"navigation\">"; // include menu list include('menu_list.php'); echo" </ul> </div> <div id=\"left_nav_footer\"></div> </div> <div id=\"maincontent\" class=\"centerbar\"> <div id=\"center_content\">"; // include Content if($content != "") include($content); else { // default notice echo"<h1>No content</h1>"; echo"<p>"; echo"There has been no content added in this section yet. Please return back later at a later date. Thank You!"; echo"</p>"; } echo" </div> <div id=\"si_closing\"><img src=\"images/si_closing.png\" alt=\"\" /></div> </div> <div id=\"rightsidebar\" class=\"rightbar\"> </div> </div> <!-- MAIN CONTENT END --> <!-- Begin Footer --> <div id=\"footer_container\"> <div class=\"footer_centerbar\"> </div> <div class=\"footer_leftbar\"> </div> <div class=\"footer_rightbar\"> </div> </div> <div id=\"footer_notice\"> <a href=\"http://validator.w3.org/check?uri=referer\"><img src=\"http://www.w3.org/Icons/valid-xhtml10-blue\" alt=\"Valid XHTML 1.0 Strict\" height=\"31\" width=\"88\" /></a> </div> <!-- End Footer --> </div> <!-- End Wrapper --> </body> </html> "; ?> Hope this gives you some ideas on how to do things. Theres always more then one ways to do something but what ever is easier for you and works should be good enough. This is the method I have just picked up while doing websites. I used to copy and paste the whole layout to each page not too long ago lol. |
|
|
|
Feb 22 2008, 09:18 PM
Post
#18
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() |