| 
	
 | 
 Posted by Peter Fox on 10/12/06 23:04 
Following on from Robert's message. . . 
>Hi, 
> 
>I'm new to php, and all of the examples I've seen show php code 
>embedded in html documents. 
> 
>My question is: How do you create and organize reusable classes or 
>modules? 
> 
>What kinds of files are used, what's the directory structure, and how 
>are these referenced from php applications? 
Good news, its very easy. 
 
 
Set up any directory structure you like - it doesn't have to be in the  
web root hierarchy.  For example I have a sub-directory for classes then  
project-based directories for tools,  testing, and so on. 
 
Now look at php.ini and you will see include_path. (Also if you're  
interested look at set_include_path which might come in handy if stuffed  
into a project specific 'configuration' php include. 
 
In your code put require_once('myCleverClass.php'); and you're away. 
 
FWIW All my code is PHP-generates-HTML ie used as a 'proper' language  
not as a bit of extra in an HTML file. 
 
 
 
 
 
 
 
 
--  
PETER FOX Not the same since the porcelain business went down the pan 
peterfox@eminent.demon.co.uk.not.this.bit.no.html 
2 Tees Close, Witham, Essex. 
Gravity beer in Essex  <http://www.eminent.demon.co.uk>
 
[Back to original message] 
 |