RE: Favortire Page template Structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have been very fond of this method that I developed over the last few
years.

Lets say you have a site with three pages.  Index, about us, and contact
us.

I create index.php like this
<?
function output() {
?>
	html stuff here
<?
}
include "template.php";
?> 

About us and contact us look the same

Template then just has 



<?
	session starting
	any security stuff here
?>
HTML Stuff
<?
output();
?>
More html




Then changing the look of the site is just in that one file.  And things
like webtrends still give accurate results.

Charles Killmer
Netgain Technology









-----Original Message-----
From: Jim MacDiarmid [mailto:jim.macdiarmid@xxxxxxxxxxx] 
Sent: Wednesday, March 24, 2004 8:36 AM
To: php-windows@xxxxxxxxxxxxx
Subject:  Favortire Page template Structure

I was interested in seeing if anyone has a favorite way of structuring
their PHP pages? For instance, I found one example where pages were laid
out as follows:

Everything was based off of index.php and parameters were submitted
through the hidden fields or through an action variable on the url
querystring.

Index.php
--------- Begin example index.php ---------- <?php
/*
 * Common include files here
 * Database connection initialization includes here
 * Security includes here
 */


/*
 * define local functions here
 */


/*
 * Initialize globals variables 
 * and constants here 
 */


/*
 * Define a main function here
 */

Function main(){

/*
 * Initialize local variables 
 * and constants here 
 */

  /* capture action variable on url querystring */	  	

  /* do something based on action */	
  
}
?>

/* HTML Code here */


-----8<-- End Example --->8--

Any thoughts on this? I'm still kinda new at PHP and wanted to learn the
best way to structure my code from the git-go.  :)

Thanks in advance,
Jim

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux