Display different content on node pages depending on user role I have a list of items visible for all anonymous user and authenticated user. Then when the user click through, if the user is anonymous, I want to tell them, "sorry must be authenticated". But if they are already authenticated I want to show them the node.

I am using:

if($logged_in) {
   //display node 
}


In my node--mycontenttype.tpl.php. How do I make this work?
Showing different content on the same page to user depending on role could be accomplished with the Panels module like so:


Install the Panels module and its dependencies.
Go to admin » structure » panels. 
Enable and edit the page "node_view" template. 
Click "add new variant".
Click "continue" on each screen until there is a button with "Add variant." Click "Add variant".
Under panel » content, click the gear in the upper left to add a panel of content for the logged in user to see. Save.
Click the gear in the upper right of the new content to get a menu. Select visibility rules » add new rule. Select role and set it how you want. Save.
If you want to show something different to anonymous users, repeat step 6 and 7 to add content and make it visible only to anonymous users.
Don't forget to save.