Question

I have a Joomla site that I am working on, building some custom modules to control content.

I am using a menuitem field type:

<field type="menuitem" name="loc_nav_item" label="Link URL" ></field>

And then echoing out:

<a href="<?php echo $params->get('loc_nav_item');"></a>

However, even though I have SEF urls active and working on the site, this creates a url based on the ID like this:

<a href="/101"></a>

I am relatively knew to Joomla, even more so with custom module creating. Is there something I am missing here that will allow the module to generate the proper, SEF url?

Joomla 1.7 (required by client...)

Was it helpful?

Solution

Yes! You need to apply the JRoute function to it - this effectively hasn't changed since Joomla 1.5 so you're fine using it on Joomla 1.7. See the Joomla doc here for more info for the 11.1 platform though.

So you need to use something along the lines of:

<a href="<?php echo JRoute($params->get('loc_nav_item'));"></a>

Also tell your client Joomla 2.5 has no visible differences to Joomla 1.7 except has a tonne of extra security features missing in Joomla 1.7. He's asking for himself to be hacked!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top