All pastes #940777 Raw Edit

Anonymous

public php v1 · immutable
·published 2008-03-13 08:25 UTC
rendered paste body
Route: <route name="static" pattern="/(page:.+).html" callback="MyProjectStaticPageRoutingCallback" module="Public" action="ShowStaticPage" stop="false"/>Autoload:<autoload name="MyProjectStaticPageRoutingCallback">%core.lib_dir%/routing/GamesLobbyStaticPageRoutingCallback.class.php</autoload>Callback:class MyProjectStaticPageRoutingCallback extends AgaviRoutingCallback{        public function onMatched(array &$parameters, AgaviExecutionContainer $container)        {                if (isset($parameters['page']))                        $page = $parameters['page'];                else                        return false;                // Recognize the page's URL, fetch its ID and pass it back as a parameter to action ShowStaticPage                $m = $this->context->getModel('Pages', 'Public');                if ($page_object = $m->lookupPageBySlum($page))                {                        $parameters['page'] = $page_object;                        return true;                }                return false; // page doesn't exist, so the route doesn't match        }}Action is emptyView:class Public_ShowStaticPageSuccessView extends ProjectBaseView{        public function executeHtml(AgaviRequestDataHolder $rd)        {                $this->setupHtml($rd);                $page = $this->getAttribute('page');                $layer = $this->getLayer('content');                $layer->setTemplate($page->getTemplate());        }}