symfony routing
php symfony app:routes frontend
Create an alias for a specific page via routing
Example: Link www.ullright.org/my_page to the CMS page with the slug "my_page_is_really_great"
#routing.yml my_page: url: /my_page/:slug class: sfDoctrineRoute options: { model: UllCmsPage, type: object } param: { module: ullCms, action: show, slug: my_page_is_really_great}
The trick is to define ":slug" in the url. Otherwise it won't work. That's why this example of a default "root" route does not work:
homepage: url: / param: { module: ullCms, action: show, slug: homepage } class: sfDoctrineRoute options: { model: UllCmsPage, type: object }
Test the current URL in template/layout
<?php if ('ullCms/show?slug=homepage' == sfContext::getInstance()->getRouting()->getCurrentInternalUri()): ?> <?php doSomething() ?> <?php endif ?>