маршрутизация:
Код: Выделить всё
catTests:
url: /cat/:id/:name_slug
class: sfDoctrineRoute
options: { model: categories, type: object }
param: { module: categories, action: testsByCat }
requirements:
id: \d+
Код: Выделить всё
static public function slugify($text)
{
// replace all non letters or digits by -
$text = preg_replace('/\W+/', '-', $text);
// trim and lowercase
$text = strtolower(trim($text, '-'));
return $text;
}
public function getNameSlug()
{
$text= Category::slugify($this->getName());
return $text;
}
у меня есть два имени в базе данных:
- английский язык
- Българский език
- английский+язык
- Българский+език
- англоязычный
- и в кириллической версии параметр пуст.
Пустой модуль и /или действие после анализа URL-адреса "/cat/1/" (/).
Подробнее здесь: https://stackoverflow.com/questions/108 ... uting-slug
Мобильная версия