Reusable modules and code organization?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

What kinds of files are used, what's the directory structure, and how
are these referenced from php applications?


Re: Reusable modules and code organization?

Robert wrote:
Quoted text here. Click to load it

You could start with .


Re: Reusable modules and code organization?

Following on from Robert's message. . .
Quoted text here. Click to load it
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
2 Tees Close, Witham, Essex.
Gravity beer in Essex  <

Site Timeline