Vizionz
Vizionz

Reputation: 13

what's the correct way to write this code

I have a code to show fields from the database. I can get it normally to show up within my joomla framework. But to perform correct links

i need to use this code

 <a href="<?php echo JRoute::_('index.php?option=time&view=one&id='.$url.'&layout=common'); ?>">


 echo "<td> that code would be here

Cant do a echo within that echo

 echo "<td><a href="<?php echo JRoute::_('index.php?option=time&view=one&id='.$url.'&layout=common'); ?>">mylink</a></td>

that would not work what would be the correct way

Upvotes: 0

Views: 104

Answers (2)

allejo
allejo

Reputation: 2203

Why are you adding the PHP tags inside of the echo? There's no need for them, you're already inside the PHP tags since you're using echo.

echo "<td><a href='" . JRoute::_('index.php?option=time&view=one&id='.$url.'&layout=common') . "'>mylink</a></td>";

Upvotes: 2

The Humble Rat
The Humble Rat

Reputation: 4696

Try this

  echo '<td><a href="' . JRoute::_( . 'index.php?option=time&view=one&id=' . $url . '&layout=common' . ) . '">mylink</a></td>';

Alteratively try the below

  ?>
  <td><a href="<?php echo JRoute::_('index.php?option=time&view=one&id=' . $url . '&layout=common'); ?>">mylink</a></td>;
  <?php

Upvotes: 0

Related Questions