Execute php scripts like a function call

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ashly
Forum Newbie
Posts: 9
Joined: Thu Dec 21, 2006 12:14 am

Execute php scripts like a function call

Post 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
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Front Controller ... or more generic the Command pattern.
(#10850)
ashly
Forum Newbie
Posts: 9
Joined: Thu Dec 21, 2006 12:14 am

Post by ashly »

arborint wrote:Front Controller ... or more generic the Command pattern.
I don't understand .. what is that? can you please explain?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post 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.
(#10850)
Post Reply