I don’t understand what the problem is, for example, I don’t know if you are setting $ id and $ output to any value. I do not know if the context of the code you posted is in the PHP line or in the template.
However, if this is just a matter of syntax, then it might be better:
Like a PHP string:
$out = '<a href="/' . $id . '">' . $output . '</a>';
Alternative:
$out = "<a href=\"/$id.php\">$output</a>";
In HTML:
<a href="/<?php print $id; ?>.php"><?php print $output; ?></a>
or even:
<?php print '<a href="/' . $id . '">' . $output . '</a>'; ?>
Hope this is your problem.
Note: printing and echo can be used interchangeably; people prefer printing in this scenario, although echo is slightly faster than IIRC. None of these functions is a function, so it is not necessary to include brackets such as print ('blah').
source share