Re: Structure of PHP files

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

 



When I first started programming in PHP I used the second method you mentioned. I had a single file I called utils.php and it contained all the functions I could possibly need throughout my site. Unfortunately, this file grew to be over 10,000 lines and most of the time I only needed a couple of functions for each script I loaded. I have now abandoned that method and use a more modular approach. I have a lib folder that contains much smaller and specialized scripts (mainly classes). Now I only include what I need. I found it much easier to maintain than having a single file.

Take care,
Floyd

On Jul 23, 2009, at 5:36 AM, Sándor Tamás (HostWare Kft.) wrote:

Hi,

It isn't really a programming question, but rather a structural.

Let's suppose I have a PHP page, which is built by other PHP files' includes.

Which is the better approach:
in a switch-like statement I include the required PHP files, which contain all the functions, and the HTML code to provide the functionality, or create a base PHP file which contains all the funcionality, and the PHP files only contain calls for these functions, and the HTML code?

I think the previous method gives more control and it is more repairable, but the later method gives more modularity. With your experiences, what method gives the better overall usability?

Thanks,
SanTa


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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux