Customizing SMF > SMF Coding Discussion

Color Of User Information

(1/3) > >>

briannnn:
Hey, I am trying to make it so user information like post count, rep, date registered, ect next to topic is a certain color for certain member groups. I am a Java coder not HTML coder but is there an HTML code for like


--- Code: ---if(membergroup == 1);
color: #111111
}
--- End code ---

Note: I know where to change code for this but I just need help with doing this kind of html code.

Luis-:
That isn't HTML, that's PHP. And it would be;

--- Code: ---if(membergroup == 1) {
echo '<font color="111111"></font>';
}
--- End code ---
Something like that.

IchBin™:
Better to use a tag that is not deprecated. <font> has long been replaced with color in styles. Use a span and put the color into the style tag instead.

If it were me and I was trying to do this, I'd use some PHP to change the class.


--- Code: ---if (membergroup == 1)
    $mystyle = 'mem1';
else if (membergroup ==2)
    $mystyle = 'mem2';
else
    $mystyle = 'default';
--- End code ---

Then:

--- Code: ---echo '<span class="' , $mystyle ,'">Stuff here</span>';
--- End code ---

Then you can define all those classes in your css file.

briannnn:
Is there way to do this right in my index.css because I can change the color of post count by change this

--- Code: ---.poster li.stars, .poster li.avatar, .poster li.blurb, li.postcount, li.im_icons ul
{
margin-top: 0.5em;

}
--- End code ---
to

--- Code: ---.poster li.stars, .poster li.avatar, .poster li.blurb, li.postcount, li.im_icons ul
{
margin-top: 0.5em;
        color: #452532;

}
--- End code ---

But can I add like a if(....) then .... statement right in the index.css file or no.
Heres example.

--- Code: ---.poster li.stars, .poster li.avatar, .poster li.blurb, li.postcount, li.im_icons ul
{
margin-top: 0.5em;
if(membergroup == 1);
        color: #111111;
}
--- End code ---

}

Eudemon:
no you can't add an if statement or any other programming language related statements in a css file
correct me if i am wrong

Navigation

[0] Message Index

[#] Next page

Go to full version