Skip to content

Instantly share code, notes, and snippets.

@DASPRiD
Created November 16, 2011 21:43
Show Gist options
  • Save DASPRiD/1371530 to your computer and use it in GitHub Desktop.
Save DASPRiD/1371530 to your computer and use it in GitHub Desktop.
<?php
$config['routes'] = array(
'blog' => array(
'type' => 'Literal',
'options' => array(
'route' => '/blog',
'defaults' => array(
'controller' => 'blog-entry',
),
),
'may_terminate' => true,
'child_routes' => array(
'create-form' => array(
'type' => 'Literal',
'options' => array(
'route' => '/admin/create',
'defaults' => array(
'controller' => 'blog-entry',
'action' => 'create',
),
),
),
'tag' => array(
'type' => 'Regex',
'options' => array(
'regex' => '/tag/(?<tag>[^/]+)',
'defaults' => array(
'controller' => 'blog-entry',
'action' => 'tag',
),
'spec' => '/blog/tag/%tag%',
),
'may_terminate' => true,
'child_routes' => array(
'feed' => array(
'type' => 'Regex',
'options' => array(
'regex' => '/(?<tag>[^/]+)\\.xml',
'defaults' => array(
'controller' => 'blog-entry',
'action' => 'tag',
'format' => 'xml',
),
'spec' => '/blog/tag/%tag%.xml',
),
),
),
),
'year' => array(
'type' => 'Regex',
'options' => array(
'regex' => '/year/(?<year>\d{4})',
'defaults' => array(
'controller' => 'blog-entry',
'action' => 'year',
),
'spec' => '/blog/year/%year%',
),
),
'month' => array(
'type' => 'Regex',
'options' => array(
'regex' => '/month/(?<year>\d{4})/(?<month>\d{1,2})',
'defaults' => array(
'controller' => 'blog-entry',
'action' => 'month',
),
'spec' => '/blog/month/%year%/%month%',
),
),
'day' => array(
'type' => 'Regex',
'options' => array(
'regex' => '/day/(?<year>\d{4})/(?<month>\d{1,2})/(?<day>\d{1,2})',
'defaults' => array(
'controller' => 'blog-entry',
'action' => 'day',
),
'spec' => '/blog/day/%year%/%month%/%day%',
),
),
'entry' => array(
'type' => 'Regex',
'options' => array(
'regex' => '/(?<id>[^/]+)',
'defaults' => array(
'controller' => 'blog-entry',
),
'spec' => '/blog/%id%',
),
),
'feed' => array(
'type' => 'Literal',
'options' => array(
'route' => '.xml',
'defaults' => array(
'controller' => 'blog-entry',
'format' => 'xml',
),
),
),
),
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment