Page 1 of 1

How to generate an alias

Posted: Thu Jul 26, 2007 4:51 am
by FantomCircuit
Just a simple question (I think)

I am developing a shop module, and need a way of making an alias name for a product so that I can use it for pretty urls, image naming schemes etc. (the same way one is generated for new pages; title changed to lowercase and is different to any existing alias).

Is there a function somewhere that is used for the page alias generation? I had a look through the source but can't seem to find anything (I am probably going blind :) )

Can someone point me in the right direction?

Re: How to generate an alias

Posted: Thu Jul 26, 2007 5:02 am
by FantomCircuit
Ok, I've had a bit more of a look, and found the munge_string_to_url function, which makes it lowercase and gets rid of funny characters. Now I spose I can just re-create the functionality to make sure it is unique.

Re: How to generate an alias

Posted: Thu Jul 26, 2007 2:27 pm
by savagekabbage
There are already several shop modules in the forge, maybe you could just modify one of those for your needs?  You also might want to look at how the core generates aliases, maybe you could just use that.