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?
If you are trying to generate an alias for your created component it is very simple. Suppose you have click on save
or apply button
in your created component or suppose you want to make alias through your tile, then use this function:
$ailias=JFilterOutput::stringURLSafe($_POST['title']);
Now you can insert it into database.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With