Take the 2-minute tour ×
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It's 100% free, no registration required.

The following code works in Joomla 1.6, but it throws up a Strict Standards error in 3.x:

Strict Standards: Only variables should be assigned by reference

    //Get the full URL for sharing purposes
    $uri = & JFactory::getURI();
    $absolute_url = $uri->toString();

    <?php echo $absolute_url; ?>

How can I get the code to work without the error in Joomla 3.x?

share|improve this question
Btw. it doesn't depend on Joomla version but by PHP version. Assigning variables by reference is deprecated in PHP –  turson Sep 2 at 14:02
Thanks for the tip –  RustyJoomla Sep 3 at 9:08

1 Answer 1

up vote 3 down vote accepted

Delete the &

//Get the full URL for sharing purposes
$uri = JFactory::getURI();
$absolute_url = $uri->toString();

<?php echo $absolute_url; ?>
share|improve this answer
Thanks for your help, can't believe I missed that! –  RustyJoomla Sep 2 at 11:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.