Help using routes on subpage

Hi,

Found a solution digging into the forum.

Dont know if its the proper way of doing it but seems to work :

c::set('routes', array(
   array(
      'pattern' => 'clients/(:all)',
      'action'  => function($uid) {
         go($uid);
      }
   ),
   array(
      'pattern' => '(:any)(:all)',
      'action'  => function($u1,$u2) {
         $page = page($u1.$u2);

         if(!$page) $page = page('clients/' . $u1.$u2);
         if(!$page) $page = site()->errorPage();

         return site()->visit($page);
      }
   )
));

This is the the original reply

2 Likes