Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8031735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:12:03+00:00 2026-06-05T01:12:03+00:00

I have problem whit slugify routing parameter. I want to replace all intervals and

  • 0

I have problem whit slugify routing parameter. I want to replace all intervals and symbols with "-". When parameter is with latin letters all work, but if I try to slugify parameter whit cyrillic letters I get error.

routing:

 catTests:
      url:    /cat/:id/:name_slug
      class:   sfDoctrineRoute
      options: { model: categories, type: object }
      param: { module: categories, action: testsByCat }
      requirements:
        id: \d+

slug functions:

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;
}

Example:
i have two names in databace:

  • english language
  • Български език

Normally whitin function url is :

  • english+language
  • Български+език

When i put function result is :

  • english-language
  • and on cyrillic version parameter is empty.

    Empty module and/or action after parsing the URL "/cat/1/" (/).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:12:04+00:00Added an answer on June 5, 2026 at 1:12 am

    I recommend you to use Doctrine::urlize instead of your own slugify function (since your are using Doctrine).

    And then, replace your function like:

    public function getNameSlug()
    {
      return Doctrine_Inflector::urlize($this->getName());
    }
    

    edit:

    In fact, it seems that Doctrine doesn’t well handle Cyrillic (even in the 2.0). You will have to handle it on your own. I found this function:

      public static function replaceCyrillic ($text)
      {
        $chars = array(
          'ґ'=>'g','ё'=>'e','є'=>'e','ї'=>'i','і'=>'i',
          'а'=>'a', 'б'=>'b', 'в'=>'v',
          'г'=>'g', 'д'=>'d', 'е'=>'e', 'ё'=>'e',
          'ж'=>'zh', 'з'=>'z', 'и'=>'i', 'й'=>'i',
          'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n',
          'о'=>'o', 'п'=>'p', 'р'=>'r', 'с'=>'s',
          'т'=>'t', 'у'=>'u', 'ф'=>'f', 'х'=>'h',
          'ц'=>'c', 'ч'=>'ch', 'ш'=>'sh', 'щ'=>'sch',
          'ы'=>'y', 'э'=>'e', 'ю'=>'u', 'я'=>'ya', 'é'=>'e', '&'=>'and',
          'ь'=>'', 'ъ' => '',
        );
    
        return strtr($text, $chars);
      }
    

    And then :

    public function getNameSlug()
    {
      $slug = Category::replaceCyrillic($this->getName());
      return Doctrine_Inflector::urlize($slug);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with fancybox. I want to write a function that will run
i have problem with autorotate on iphone i set up in all classes -
I have problem with HTTP headers, they're encoded in ASCII and I want to
I have a problem whit binding in wpf i have a textbox where i
I have a Custom usercontrol that I want to enlarge. I tested this whit
I have problem with code. I have written a function for extracting a parameter,
I have problem with ActionLink. I'd like to pass to my ActionLink parameter for
so i have a problem i cant solve i want my GUI app to
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have problem with cakephp's Session->write method. If I set a value like $_SESSION['..']

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.