Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 07-28-2005, 04:50 AM
  #1
hammerstein_04
Deity (Level 17)
 
hammerstein_04's Avatar
 
Join Date: Jan 2004
Location: New Jersey, USA
Posts: 891
iTrader: (0)
hammerstein_04 will become famous soon enough
Page Layout and Templating

Hi,
I have recently resumed development of my site, and in the course I have been trying to neaten things up a little and make them a little more manageable. I hope that in the coming weeks I will be getting some assistance from some real graphics artists who can help me in the styling and layout.

Since I started learning PHP I have followed the same familiar development path every time, and I am wondering if this isn't necessarily the most professional and efficient method. Basically I construct each page based on a standard header and footer;

header.php (not always named as such)

Contains opening session setup, calls to common functions and object definition files, onto the html, header with style sheets javascripts etc. etc. I layout my menu in here and then define the page body.

page.php

Contains all page content, including header and footer either side of the page content.

footer.php

Does any cleanup I need, closes the body and html.

Is this the only sane method of developing pages, if so are there any hints and tips? I do make quite heavy use of stylesheets so I can replace everything if necessary and background colours, font colours etc will be changed quickly.

Are there limits I should be wary of, my main stylesheet is 10k, my function library another 10 and my object definitions are 5 or 6k each (2 - 3 of them). Although that doesn't show a lot on my site right now, I like to have things as adaptable as possible, and if I may reuse a section later on then I will put it to a style.

I don't include files unnecessarily, if there is only one area of the site some code is used, I will include it in the single php page not the header.

This is kinda an opinion thread as such, but i do feel it better suites the PHP forum as opposed to the lounge, as I am asking for some advice as to alternatives and methods. I hope I didn't get this wrong.
__________________
For web design and software development;


Hypersonicscream
hammerstein_04 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-01-2005, 07:55 AM
  #2
scoutt
Mister Admin to you
 
scoutt's Avatar
 
Join Date: Jul 2001
Posts: 30,868
iTrader: (0)
scoutt is a jewel in the roughscoutt is a jewel in the roughscoutt is a jewel in the roughscoutt is a jewel in the rough
10k for a style sheet, that is excessive. bet you can consolodate that and make it at least 1-2k. you don't need a style for each and every aspect of the layout. some styles get are propergasted down to the children.

but other than that you have the right idea.
__________________
Have a Script or Snippet you want to share?

WWW Standards: HTML 4.01, CSS2.1, CSS3, XHTML 1.0
PHP Standards: PHP Standards
scoutt is online now   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-01-2005, 12:46 PM
  #3
AaronCampbell
Resident PHP OOP Master
 
AaronCampbell's Avatar
 
Join Date: Aug 2003
Location: Chained to my computer
Posts: 1,619
iTrader: (0)
AaronCampbell is on a distinguished road
I agree, I'd take a long look at that stylesheet, but I do basically the same thing for my sites.

I have a header1.php, which includes a prepend.php file (sometimes I set up my php.ini to automatically include prepend.php). Prepend.php has my session start, db connections, and functions that are used on almost every page. Header1.php has the start of my XHTML/HTML, down to the bottom of the <head> section, but NOT including the closing head tag.

Then I have header2.php wich includes the closing head tag, opening body tag, and usually a header, or title-bar, etc (depending on what your page looks like). The reason for having 2 headers is so I can still insert stuff into the head of the document if I need to (an additional CSS sheet, or JS, etc).

Lastly, I have a footer.php, wich cleans up whatever is opened in the header pages.

Then, any of my documents might look like this:
PHP Code:
<?php
include("header1.php");
include(
"header2.php");
?>
Content
<?php include("footer.php"); ?>
AaronCampbell is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-02-2005, 04:42 AM
  #4
hammerstein_04
Deity (Level 17)
 
hammerstein_04's Avatar
 
Join Date: Jan 2004
Location: New Jersey, USA
Posts: 891
iTrader: (0)
hammerstein_04 will become famous soon enough
Thanks for the replies guys. Much appreciated.
__________________
For web design and software development;


Hypersonicscream
hammerstein_04 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart



 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 07:35 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.