Skip to content

Instantly share code, notes, and snippets.

@hejrobin
Created April 15, 2011 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hejrobin/921737 to your computer and use it in GitHub Desktop.
Save hejrobin/921737 to your computer and use it in GitHub Desktop.
Demo of some of some routes in Architect
<routes>
<defaultController>Default</defaultController>
<!-- A simple custom route -->
<route path="about-us">
<controller callback="aboutUsPage">Company</controller>
</route>
<!-- A bit more complex route -->
<route path="archives/((19|20)?[0-9]{2})/(\d{2})/(\d{2})">
<controller callback="showEntriesByDate">BlogArchives</controller>
<params>
<param>$1</param>
<param>$2</param>
<param>$3</param>
</params>
</route>
<!-- A route with the new request type rules -->
<route path="request">
<controller>Request</controller>
<request type="get" callback="get" />
<request type="post" callback="post" />
<request type="put" callback="put" />
<request type="delete" callback="delete" />
<request type="get" callback="getAjax" ajax="true" />
<request type="post" callback="postAjax" ajax="true" />
<request type="put" callback="putAjax" ajax="true" />
<request type="delete" callback="deleteAjax" ajax="true" />
</route>
<!-- Using wildcard (define wildcards in core-bootstraps.php, as: $arch->router->setWildcard('my_wildcard', '/regex/') ) -->
<route path="beam-me-up/:my_wildcard">
<controller callback="beamTargetToShip">TeleportationInterface</controller>
<params>
<param>$1</param>
</params>
</route>
</routes>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment