Hiya, I tried to code this in phptemplate, I wrote this is page.tpl.php:

//if user is logged in, show left, if user is also admin, show right.
global $user;
if ($user->uid) {
if ($user->uid == 1) {
print $sidebar_left;
} else {
print $sidebar_right;
}
} else {
return;
}

If the admin is logged in, it seems to work fine and I get the left column block, but when I went to my site as anonymous the page just stopped where I pasted this code.
Like in the middle of the HTML, there was just blank.

The code is not supposed to show any block to anonymous users but I do want the rest of the page markup to render because my site is busted without it.

what's wrong with my code?

Comments

JurriaanRoelofs’s picture

I just discovered that the code work like it's supposed too when the admin is logged in, but when the admin logs off, the sites is broken for everybody

-------------------------------
http://www.sooperthemes.com/#-Drupal-Themes

nevets’s picture

The code ends with

else {
return;
}

and is the section that handles anonymous users. The return statement though is causing it to stop processing the page. You can drop the 'else' along with the return statement and things should be fine.

JurriaanRoelofs’s picture

that was it, thanks :)

-------------------------------
http://www.sooperthemes.com/#-Drupal-Themes