I have a custom component, it allows admins to select a related content article from the #__content table using the following:

<field name="relatedcontent" type="sql" default="10" label="Related item" 
    sql_from="#__content AS e" 
    sql_order="e.title ASC" 
    header="Please select your option"/>

This then allows me to show in the frontend as follows:

$id_one = $this->item->interested_in_one;
<a href="<?php echo JRoute::_('index.php?option=com_content&view=article&id=' . $id_one); ?>">

This gets the ID of the selected content article and creates the URL accordingly from above.

I need to further extend this by:

  • getting the alias (of the content article) in the URL
  • stop Joomla from adding '&Itemid=101' to the end of the URL, or at least load the correct one


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.