Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Tutorials SEO friendly URL string using CakePHP
Chris
Posted on 13 Jan 2012, 18:36:58

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

CakePHP's built in Inflector class comes with a few handy methods, one of which is the slug method that lets you convert strings to SEO friendly URLs. The first parameter is the string to convert, the second is the delimiter used to separate each word.

<?php
$str = "This is the string I want to convert";
echo Inflector::slug($str, '-');
?>

Outputs

This-is-the-string-I-want-to-convert

#3684
Last edited by Chris at 2012-01-13 18:37:55 Reason: .
Network-13.com © 2013