How to show the user badges in my tpl.php file? This maybe a dumb question but what am I doing wrong?

From here: https://www.drupal.org/node/942014

It says I have to insert:

if (module_exists('user_badges')) {
    print user_badges_for_uid($uid);
  }

When I insert that on the last line of my  node.tpl.php it just shows as Text (like the whole code shows on the website). What am I doing wrong??

Can someone please help me?
The first thing that you need to do is add the php tag to the code:

&lt;?
if (module_exists('user_badges')) {
 print user_badges_for_uid($uid);
}
?&gt;


But for to that this code works you need to pass the uid = User Id

This code should do the job:

&lt;?
// Getting the actual user.
global $user;

if (module_exists('user_badges')) {
 print user_badges_for_uid($user-&gt;uid);
}
?&gt;