All pastes #845346 Raw Edit

Someone

public php v1 · immutable
#845346 ·published 2008-01-07 17:14 UTC
rendered paste body
class StaticPageRoutingCallback extends AgaviRoutingCallback{        public function onMatched(array &$parameters, AgaviExecutionContainer $container)        {                if (isset($parameters['page']))                        $page = $parameters['page'];                else                        return false; // if the $page parameter not supplied,				      // the route doesn't match and falls through                // Recognize the page's URL, fetch its ID and pass it back as a parameter to action ShowStaticPage                $m = $this->context->getModel('Pages', 'Foo');		// Ask the model to convert the page parameter from the request		// into a page_id parameter so that subsequent actions know		// which page to fetch from the database.                 $parameters['page_id'] = $m->lookupPageBySlum($page);		// the route matched, so execute the action associated with it		// the action's view now accesses the page_id parameter and fetches		// the relevant page                return true;        }}