Hey

I had a look at the documentation and the simple code but am still stuck, so I need your help

What I am trying to do is get the node title (like “A Wonderful Node Title”).
Convert it to lowercase and replace the spaces with dashes (like “a-wonderful-node-title”).

i found this site http://www.socialgeek.be/blog/read/clean-urls-through-readable-slugs-in-php where i trying to get the code to work

Thanks

Comments

minesh’s picture

Status: Active » Closed (fixed)

i fixed it

$match= strtolower($node->title);
$node_field[0]['value'] = str_replace(' ', '-', $match);

this will get the node title like "HELLO WORLD"
turned it in to lowercase "hello world"
then replace the space with a dash "hello-world"

I am using this in a view, so i can use it in to make a url

wolfy’s picture

do you have any idea on how to apply this to a name of an images????????

i have used the transliteration module but it coast me a missing data cause it converts the utf-8 to a us-asccii
so it makes the old images to be broken exactly when u have a non asscii characters.