user1555112
user1555112

Reputation: 1987

cakephp 2.5.1: Inflector::slug

I am using this for slugging:

<?php echo $this->Html->Link(__('more'), '/l/'. Inflector::slug($data['Object']['region']) .'/'. Inflector::slug($data['Object']['cat']) .'/'. Inflector::slug($data['Object']['title']) .'/'. $data['Object']['id'], array('class' => 'regular_btn'));?>

to get nice SEO friendly links. Works fine so far, the result looks like

.../l/reg/cat/Postmodern_luxury_residence_close_to_Real_Bendinat_golf_course/123

I just wished that the _ could be a - instead? Is that possible to change?

Thanks!!

Upvotes: 0

Views: 159

Answers (1)

arilia
arilia

Reputation: 9398

it should be simply

Inflector::slug($data['Object']['region'], '-')

http://api.cakephp.org/2.5/class-Inflector.html#_slug

Upvotes: 1

Related Questions