public
Created

Demo of some of some routes in Architect

  • Download Gist
gistfile1.xml
XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
<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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.