This question already has an answer here:
In PHP is it possible to use site_url within an echo statement that already contains text? For instance could i change:
$data['following'] = 'You are not following ' . $name . ' <a href="http://raptor.kent.ac.uk/proj/co539/microblog/jlo21/index.php/user/follow/' . $name . ' ">Follow this user</a>';
to
$data['following'] = 'You are not following ' . $name . ' <a href="<?php echo site_url("user/follow"); ?>">Follow this user</a>
</div>
$data['following'] = 'You are not following ' . $name . ' <a href="' . site_url("user/follow") . '">Follow this user</a>;
No, but why not just concatenate the return value instead of trying to echo
it?
$data['following'] = 'You are not following ' . $name . ' <a href="' . site_url("user/follow") . '">Follow this user</a>
You can use a function call inside a string concatenation:
$data['following'] = 'You are not following ' . $name . ' <a href="'. site_url("user/follow") . '">Follow this user</a>';
The function will return the string and it will be concatenated like a variable would.