Re: Structure of PHP files

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

 



2009/7/23 Sándor Tamás (HostWare Kft.) <sandortamas@xxxxxxxxxxx>

> 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


As far as i experienced, the second method brings problems about the
"REQUIRE".

If you do put classes and functions directly in that "base PHP file", it
will looks fat , and you need a lot of copy/pastes.

If you just put a lot of "requires" in that "base PHP file", you may pay
attention about the PATH. Usage of "__FILE__" or "__autoload" may bring
confusions.

Hoping for the coming of the concept of PACKAGE. Seems that NAMESPACE will
be introduced in PHP6.


Dengxule
09/07/23

[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