Re: Using a single php entry file for a whole site. [message #181864 is a reply to message #181861] |
Thu, 20 June 2013 19:06 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 20/06/13 19:23, Stefan Froehlich wrote:
> On Thu, 20 Jun 2013 19:22:18 The Natural Philosopher wrote:
>> ALL request to a site are redirected by apache rules to one single file.
>> Let's call it index.php. Index.php notes the URL the user wants and looks
>> it up in a database, and if it exists, includes() the actual PHP file
>> for that page.
> [...]
>> Is this possible, and if so what if any are the downsides?
> Definitely, yes. I do it quite similar with the only difference that I
> do not include() the desired page, but rather each page is a class derived
> of an abstract parent class. This opens some nice possibilities to define
> page title, access rights and things like that and it makes it possible
> to construct an object hierarchy with similar pages grouped together.
>
> Stefan
>
Nice approach. I don't like objective code, but I do write code in an
object oriented way.
Typically by having include files that contain essentially private data
accessible by predetermined functions.
It may turn out that 'going OO' is a good idea, but I'll wait till the
ideas develop.
In many ways I'd rather do that level of abstraction in the database as
well.
Still: food for thought.
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
|
|
|