Using parameter %s in Joomla language files

Sometimes you want to write in your ini files something like

MESSAGE=Thank you for registration, %s! Now you can <a href="%s">login</a>.

and then while displaying this message substitute necessary strings instead of %s.

So. Joomla does allow this but only for language files. To parse this message you should write

JText::sprintf('MESSAGE', $username, $url)

The first parameter is property name. The second parameter $username goes for first %s, $url goes for second %s and so on.

Posted By admin

Leave a Reply

You must be logged in to post a comment.