MyBB Community Forums

Full Version: gender icon on thread view
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Yes I do. They are specifying how to display it with css. You way is the simplest I've seen on this thread.
(2012-11-19, 09:50 PM)Leefish Wrote: [ -> ]Well, why not just have the image link?

Something like <img src="images/{$post['fid3']}.png" /> and have the images named after the fields? Know what I mean?

I'm not opposed to that. Of course, CSS would be preferable. However, at this point, I'd just like to find the answer as to WHY it won't work! Big Grin

It's my passive-aggressive-obsessive-compulsive side.

(2012-11-19, 09:52 PM)JordanMussi Wrote: [ -> ]Yes I do.

I'm not sure what or who you were answering. Dodgy LOL
Well, why the CSS won't work? I have no idea.

The img thing WILL work and it is not hugely different - it is just a different approach that is all. Ever heard the saying more than one way to crack a nut?

* Leefish swings mighty img src sledgehammer at trembling postbit peanut


Ok, I succumbed to curiosity. Css approach works.... ?

my css for female:

 .Female {
   background-image: url(images/female.png);
 }
I've tried it again this morning with no luck. Thought I'd give it a fresh try and list some details here...

- cleared cache
- tried in multiple browsers
- tried in multiple accounts
- tried to create new account to see if would show up
- tried logged in and logged out
- still suspicious it's a CSS issue

My custom profile field info: - VERIFIED ID# IS 5

Quote:- Title: Gender
- Short Description: Please select your gender from the list below.
- Field Type: Select Box
- Maximum Length: 0
- Field Length: 0
- Selectable options? (in this order, all lowercase)
--- undisclosed
--- male
--- female
--- other
- Display Order: 2
- Required: Yes
- Editable by User: Yes
- Hide on Profile: No
- Minimum Post Count: 0

My postbit template:

{$ignore_bit}
<a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
	<tbody>
		<tr>
			<td class="tcat">
				<div class="float_left smalltext">
					{$post['postdate']}, {$post['posttime']} <span id="edited_by_{$post['pid']}">{$post['editedmsg']}</span>
				</div>
				{$post['posturl']}
			</td>
		</tr>

		<tr>
			<td class="trow1 {$unapproved_shade}">
				<table cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
					<tr>
						<td class="post_avatar" width="1" style="{$post['avatar_padding']}">
<if $post['avatar'] then>
{$post['useravatar']}
<else><img src="{$mybb->settings['bburl']}/images/avatars/default.png" alt="avatar" height="100px" width="75px" />
</if>
						</td>
						<td class="post_author">
							<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
							<span class="smalltext">
								{$post['usertitle']}<br />
								{$post['userstars']}
								{$post['groupimage']}
							</span>
						</td>
						<td class="smalltext post_author_info" width="165">
							{$post['user_details']}

<br />Gender: <span class="gender {$post['fid5']}" title="{$post['fid5']}"></span>
						</td>
					</tr>
				</table>
			</td>
		</tr>

		<tr>
			<td class="trow2 post_content {$unapproved_shade}">
				<span class="smalltext"><strong>{$post['icon']}{$post['subject']} {$post['subject_extra']}</strong></span>

				<div class="post_body" id="pid_{$post['pid']}">
					{$post['message']}
				</div>
				{$post['attachments']}
				{$post['signature']}

				<div class="post_meta" id="post_meta_{$post['pid']}">
				{$post['iplogged']}
				</div>
			</td>
		</tr>

		<tr>
			<td class="trow1 post_buttons {$unapproved_shade}">
				<div class="author_buttons float_left">
					{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}{$post['button_rep']}
				</div>
				<div class="post_management_buttons float_right">{$post['button_spam']}{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}
				</div>
			</td>
		</tr>
	</tbody>
</table>

My postbit_classic template:

{$ignore_bit}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="{$post_extra_style} {$post_visibility}" id="post_{$post['pid']}">
	<tr>
		<td class="{$altbg}" width="15%" valign="top" style="white-space: nowrap; text-align: center;"><a name="pid{$post['pid']}" id="pid{$post['pid']}"></a>
		<strong><span class="largetext">{$post['profilelink']}</span></strong> {$post['onlinestatus']}<br />
		<span class="smalltext">
			{$post['usertitle']}<br />
			{$post['userstars']}
			{$post['groupimage']}
			
<if $post['avatar'] then>
{$post['useravatar']}
<else><img src="{$mybb->settings['bburl']}/images/avatars/default.png" alt="avatar" height="100px" width="75px" />
</if>

<br />
			{$post['user_details']}
<br />Gender: <span class="gender {$post['fid5']}" title="{$post['fid5']}"></span>
		</span>
	</td>
	<td class="{$altbg}" valign="top">
		<table width="100%">
			<tr><td>{$post['posturl']}<span class="smalltext"><strong>{$post['icon']}{$post['subject']} {$post['subject_extra']}</strong></span>
			<br />
			<div id="pid_{$post['pid']}" class="post_body">
				{$post['message']}
			</div>
			{$post['attachments']}
			{$post['signature']}
			<div style="text-align: right; vertical-align: bottom;" id="post_meta_{$post['pid']}">
				<div id="edited_by_{$post['pid']}">{$post['editedmsg']}</div>
				{$post['iplogged']}
			</div>
		</td></tr>
	</table>
</td>
</tr>
<tr>
	<td class="{$altbg}" style="white-space: nowrap; text-align: center; vertical-align: middle;"><span class="smalltext">{$post['postdate']} {$post['posttime']}</span></td>
	<td class="{$altbg}" style="vertical-align: middle;">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr valign="bottom">
				<td align="left" ><span class="smalltext">{$post['button_email']}{$post['button_pm']}{$post['button_www']}{$post['button_find']}{$post['button_rep']}</span></td>
				<td align="right">{$post['button_spam']}{$post['button_edit']}{$post['button_quickdelete']}{$post['button_quote']}{$post['button_multiquote']}{$post['button_report']}{$post['button_warn']}{$post['button_reply_pm']}{$post['button_replyall_pm']}{$post['button_forward_pm']}{$post['button_delete_pm']}</td>
			</tr>
		</table>
	</td>
</tr>
</table>

My CSS:

.gender {
display: inline-block;
vertical-align: middle;
width: 32px;
height: 32px;
background-repeat: no-repeat;
background-position: center center;
}

.undisclosed {
background-image: url(images/undisclosed.png);
}

.male {
background-image: url(images/male.png);
}

.female {
background-image: url(images/female.png);
}

.other {
background-image: url(images/other.png);
}

Location of My Images:

Quote:- My board is located in ROOT, so my domain is my board.
- I've uploaded the images to the directory of ROOT/images/
- They are all in .png format
- They are 32 x 32 in size
I was answering to Leefish.
@ jordan - stop being a pest Toungue

@ OP. I don't know what to say. I just added the css and HTML straight from Johnny's post. It worked.

What is the class in firebug?
@Leefish - Don't judge/critisize Toungue
* Leefish cuffs Jordan. Darned youngins (get offa mah lawn)
ha ha Smile
(2012-11-20, 08:41 PM)Leefish Wrote: [ -> ]What is the class in firebug?

When I inspect that element with firebug (thanks for the firebug recommendation, btw, awesome), it shows the following:

<span title="" class="gender "></span>

.gender {
background-position: center center;
background-repeat: no-repeat;
display: inline-block;
height: 32px;
vertical-align: middle;
width: 32px;
}
Pages: 1 2 3