Page 1 of 1

Execute php scripts like a function call

Posted: Mon Feb 26, 2007 11:37 pm
by ashly
Hi,
I have to execute multiple PHP scripts conditionally from a single PHP script, that is executed by a cron. Actually i wanted to do is instead of using require or include for each page, execute each page directly from the script like a function call.
is there any methods in PHP? if anybody have any idea, pls reply..

Thanks
Ashly

Posted: Mon Feb 26, 2007 11:44 pm
by Christopher
Front Controller ... or more generic the Command pattern.

Posted: Mon Feb 26, 2007 11:59 pm
by ashly
arborint wrote:Front Controller ... or more generic the Command pattern.
I don't understand .. what is that? can you please explain?

Posted: Tue Feb 27, 2007 12:47 am
by Christopher
A Front Controller is a single point of entry that in turn executes "actions" based on parameters passed to it. In PHP it usually loads Action Controller classes that all have the same interface (the Command pattern). If you go the next step then you specify parameters for both the "controller" and "action", which tells the Front Controller to execute specific class method -- the "controller" is used to determine the class name, the "action" to determine the method name. The Front Controller loads and instantiates a controller class object.