Já tive problema com isso, acho que no IE/FF ele dá erro.
Tu vai precisar criar uma função no model, para remover isso, vou te mandar a função e como fiz.
Criei esse arquivo criei no root, e chamo ele no index.php
global.php
/**
* Creates a slug [a-zA-Z0-9-]
* @param string $text
* @param int $limit number of characters to be included in slug
* @param boolean $lower
* @return string $slug
*/
function slug($text, $limit = 100, $lower = true) {
$azhifen = array(
'Á' => 'A', 'À' => 'A', 'Ã' => 'A', 'Â' => 'A', 'Ä' => 'A', 'Æ' => 'AE', 'Å' => 'A',
'á' => 'a', 'à' => 'a', 'ã' => 'a', 'â' => 'a', 'ä' => 'a', 'æ' => 'ae', 'å' => 'a',
'É' => 'E', 'È' => 'E', 'Ê' => 'E', 'Ë' => 'E',
'é' => 'e', 'è' => 'e', 'ê' => 'e', 'ë' => 'e',
'Í' => 'I', 'Ì' => 'I', 'Î' => 'I', 'Ï' => 'I',
'í' => 'i', 'ì' => 'i', 'î' => 'i', 'ï' => 'i',
'Ó' => 'O', 'Ò' => 'O', 'Õ' => 'O', 'Ô' => 'O', 'Ö' => 'O', 'Ø' => 'O',
'ó' => 'o', 'ò' => 'o', 'õ' => 'o', 'ô' => 'o', 'ö' => 'o', 'ø' => 'o', 'ð' => 'o',
'Ú' => 'U', 'Ù' => 'U', 'Û' => 'U', 'Ü' => 'U',
'ú' => 'u', 'ù' => 'u', 'û' => 'u', 'ü' => 'u',
'Ç' => 'C', '?' => 'C', '?' => 'C',
'ç' => 'c', '?' => 'c', '?' => 'c',
'Ñ' => 'N', 'ñ' => 'n',
'Ý' => 'Y', '?' => 'y', 'ý' => 'y', 'ÿ' => 'y',
'Þ' => 'B', 'ß' => 'Ss',
'?' => 'R', '?' => 'r',
'?' => 'S', '?' => 's',
'?' => 'Dj', '?' => 'dj',
'?' => 'Z', '?' => 'z',
' ' => '-', '-' => '',
',' => '', '.' => ''
);
$slug = strtr($text, $azhifen);
$slug = preg_replace('/ {2,}/', ' ', $slug); // remove unnecessary white spaces
$slug = trim($slug);
$slug = preg_replace('/[^a-zA-Z0-9-]/i', '-', $slug);
if ($lower)
$slug = strtolower($slug);
return $slug;
}
model/Noticia.php
public function getUrl() {
return Yii::app()->createUrl($this->tableName().'/view', array('id' => $this->primaryKey, 'seo' => slug($this->titulo)));
}
Rota:
'<controller:\w+>/<id:\d+>-<seo:.+>.html' => '<controller>/view',
Perdão esqueci de falar como e chamado.
Se tu usar o $var = Model::model()->findAll();
no foreach() usa $var->url;