1

The link in a HTML file:

<a href="<?= Config::get('URL') . 'profile/showProfile/' . $user->user_id; ?>">Profile</a>

Works!

The same link in a PHP file:

echo "<a href='"<?= Config::get('URL') . 'profile/showProfile/' . $user->user_id; ?>"'>Profile</a>";

Does not work!

What am I doing wrong?

1
  • are you sure you have short-tags enabled? replace <?= to <?php echo Commented Feb 14, 2015 at 7:51

2 Answers 2

3

You don't need to include <?= when you are already executing as PHP code.

echo "<a href='" . Config::get('URL') . 'profile/showProfile/' . $user->user_id . "'>Profile</a>";
Sign up to request clarification or add additional context in comments.

1 Comment

No problem mate. Sometimes it is the simplest things that we overlook. :)
0

try this

$url = Config::get('URL');
echo "<a href='".$url. 'profile/showProfile/'.$user->user_id."'>Profile</a>";

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.