Welcome Guest, Not a member yet? Register   Sign In
Creating dynamic functions based on values from database
#4

[eluser]marcoss[/eluser]
[quote author="modena" date="1223264074"]Many thanks inparo for your reply.

So its impossible to define new functions, that answered my question. Smile[/quote]

You can still use the _remap function to do something like this http://site.com/username.

Code:
<?php
class Gateway extends Controller {
    
    function _remap($dynfunc){
        ( $this->_isAllowed($dynfunc) ) ?
            $this->run($dynfunc)
        :
            $this->default_function($dynfunc)
        ;
    }
    
    function _isAllowed($dynfunc){
        //Check is $dynfunc is found on the database, return true/false.
    }
    
    function run($dynfunc){
        //$dynfunc is passed as a parameter, but since the url won't change is looks like a regular segment.
    }
    
    function default_action($dynfunc){
        //The $dynfunc is not present in DB, so we run the default action.
        //$dynfunc is passed as a parameter in case you want to perform some logging or to inform the user about it.
    }
    
}
?>


Messages In This Thread
Creating dynamic functions based on values from database - by El Forum - 10-05-2008, 09:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB