title: Yii r1.8 Using Custom URL Rule Classes
body: <p>I am trying to take advantage of the <a href="http://code.google.com/p/yii/source/browse/trunk/docs/guide/topics.url.txt#342" rel="nofollow">Custom URL Rule Classes</a> in Yii r1.8</p>
  
  <p>I am trying to take something that looks like orgs/view/id/24 and instead display the name of the org as identified by Name in the db (i.e. changing www.mysite.com/orgs/view/id/24 to www.mysite.com/jaysshop dynamically ).  Unfortunately I am not getting it to work.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>class OrgsUrlRule extends CBaseUrlRule
  {
      public $connectionID = 'db';
  
      public function createUrl($manager,$route,$params,$ampersand)
      {
          if ($route==='orgs/view/id')  //even tried 'orgs/view' or 'orgs/index'
          {
              if (isset($params['Name']))
                  return $params['Name'];
              else if (isset($params['Name']))
                  return $params['Name'];
          }
          return false;  
      }
  
      public function parseUrl($manager,$request,$pathInfo,$rawPathInfo)
      {
          if (preg_match('%^(\w+)(/(\w+))?$%', $pathInfo, $matches))
          {
          }
          return false;  
      }
  }
  </code></pre>
  
  <p>urlManager:</p>
  
  <pre><code>array(
    'class' =&gt; 'application.components.OrgsUrlRule',
    'connectionID' =&gt; 'db',
  ),
  </code></pre>