By magnus on
I have a mod of Garland 6 and I would like to have different body.png for anonymous and authenticated users. In style.css I found the class #wrapper that I have to change somewhat. I got some help on IRC, but I couldn't figure out how to make it work. Is there anyone who could help me?
In page.tpl.php
<!-- Layout -->
<div id="header-region" class="clear-block"><?php print $header; ?></div>
<div id="wrapper">
<div id="container" class="clear-block">
<div id="header">
<div id="logo-floater">
</div>
...
...
</div> <!-- /header -->
...
...
</div> <!-- /container -->
</div>
<!-- /layout -->
and in style.css
#wrapper {
background: #edf5fa url(images/body.png) repeat-x 0% -37px;
}
Comments
Wanna do some coding?
Well, if you like to do some coding in your page.tpl.php, I can suggest some fixes.
You can check the user roles and set the background image accordingly. Like as follows:
You can also check the roles as well.
Hope this will help you.
Thank you.
Beautifulmind
Know more
Regards.
🪷 Beautifulmind
I think the easy way is to
I think the easy way is to give the #wrapper a class so you so something like this:
Thant's another solution
yeah, that can be an alternative to some tedious coding. sort and sweet!
Beautifulmind
Know more
Regards.
🪷 Beautifulmind
Thanks for quick responses
Thanks for quick responses both of you!
I used
<div id="wrapper" class="<?php echo (user_is_logged_in()) ? 'class_for_authenticated' : 'class_for_anonymous'; ?>">I tried this in my style.css but that doesn't work.
Need to learn some CSS I guess =)
Been a while since I tried
Been a while since I tried this. Today I did some trial-and-error and found out why it didn't work.
If someone else wants to know how to handle this I used this in my style.css: