Is there a Joomla function to generate the 'alias' field?

DisgruntledGoat picture DisgruntledGoat · Nov 12, 2009 · Viewed 15.9k times · Source

I'm writing my own component for Joomla 1.5. I'm trying to figure out how to generate an "alias" (friendly URL slug) for the content I add. In other words, if the title is "The article title", Joomla would use the-article-title by default (you can edit it if you like).

Is there a built-in Joomla function that will do this for me?

Answer

jlleblanc picture jlleblanc · Nov 12, 2009

Line 123 of libraries/joomla/database/table/content.php implements JFilterOutput::stringURLSafe(). Pass in the string you want to make "alias friendly" and it will return what you need.