Need help in sidebar

Discussion in 'CSS' started by kearra, Mar 4, 2011.

  1. #1
    Hello and good day everyone... Im having problem on my sidebar... I have this code #fw-sidebar {background: url('www.example.com/example.jpg') no-repeat;}

    How can i change the background of my sidebar when im logged in? I want to simply change the background of my sidebar when im logged in or my users are logged in....

    This code also works #fw-sidebar a:visited {background: url('www.example.com/changeexample.jpg') no-repeat;} but the only changes it made is for my fonts.... Please help...

    Thank You so Much and bless you all...
     
    kearra, Mar 4, 2011 IP
  2. biiccs

    biiccs Member

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #2
    Hi,

    I think you need some improve of you script (example: php). So in your html page, head section you must write condition for logged or guest users. Example:

    
    <head>
    ...
    <?php
       if($user_logged)
       {
           echo '<link type="text/css" rel="stylesheet" href="../css_folder/logged.css"  />';
       }
       else
       {
           echo '<link type="text/css" rel="stylesheet" href="../css_folder/guest.css"  />';
       }
    ?>
    ...
    </head>
    
    Code (markup):
    Or maybe is different way, but I don't know it at this time.
     
    biiccs, Mar 4, 2011 IP
  3. artus.systems

    artus.systems Well-Known Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    103
    #3
    what biiccs suggested will work, but instead of creating separate css files create two css classes e.g.
    .guest_background { background: }
    .member_background { background: }
     
    artus.systems, Mar 4, 2011 IP
  4. biiccs

    biiccs Member

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #4
    How I stupid :D Maybe I'm was not enough awake. artus.systems suggestion is much better than me.
     
    biiccs, Mar 4, 2011 IP
  5. kearra

    kearra Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you for the replies... But i only need the sidebar background to change... I saw someone do that on blogger but they just said that its in the css...
     
    kearra, Mar 4, 2011 IP
  6. kearra

    kearra Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    For example... When logged in my sidebar background is red... When logged out my sidebar will turn to black...
     
    kearra, Mar 4, 2011 IP
  7. Divisive Cottonwood

    Divisive Cottonwood Peon

    Messages:
    1,674
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You need to use PHP for this kearra. By logging in you are interacting with the database.

    So log in -> connection with database -> change CSS -> log out -> connection with database -> change CSS
     
    Divisive Cottonwood, Mar 4, 2011 IP
  8. AtSeaDesign

    AtSeaDesign Active Member

    Messages:
    172
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    93
    #8
    php and javascript will do the trick. You don't need separate style sheets, just add and remove a class on the navbar depending if the user is logged in or not.

    logged in, set the style on your element.

    
    document.getElementById("blah").className = "cssclass";
    
    Code (markup):
    logged out, set the class again
     
    AtSeaDesign, Mar 4, 2011 IP
  9. kearra

    kearra Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thank you guys... But i dont have access on my php, javascript or html... I use website builder and we only have access on css....
     
    kearra, Mar 5, 2011 IP
  10. joy1986joy

    joy1986joy Member

    Messages:
    189
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #10
    Hi
    Only with CSS I think its difficult to do. Because when you are using the Login and Logout condition you must have to inform to the css to change. But it is not possible with out any language like java script or PHP.
     
    joy1986joy, Mar 6, 2011 IP
  11. kearra

    kearra Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    FINALLY!!! I got it!!! I used css, but the missing part was the module.. Ive been looking for the # codes but when logged out or not sign in, the source is not the same as the backdoor of the log-in menu. So the idea was to change module... Anyway, im just excited that i did it... Thank you for the reply though...
     
    kearra, Mar 7, 2011 IP