Robert
23rd January 2005, 07:24 AM
I have added a couple of new profile fields for my members but when these are displayed in the postbit I would like to have images instead of words displayed.
Does anyone have any idea how to do this?
Floris
23rd January 2005, 07:44 AM
Not really sure what you mean, but if you mean the $post[fieldx] is like an URL ending with file.gif - you can do this:
<img border="0" src="$post[fieldx]" />
Robert
23rd January 2005, 08:15 AM
Thanks. What I meant was that things like MSN, Yahoo, Online/Offline are all displayed in postbit as images rather than text. I have added a new custom field but instead of displaying the info as text, e.g. male/female or "country name" I would like it displayed as an image.
darnoldy
23rd January 2005, 08:32 AM
I have added a new custom field but instead of displaying the info as text, e.g. male/female or "country name" I would like it displayed as an image.
If the possible values for the field are limited and knowable, yes you can. Take the male/female example. There are three possible values for such a field, male, female, or undisclosed.
You could use Floris' code:
<img border="0" src="$post[fieldx].gif" />
which would then display either male.gif, female.gif, or undisclosed.gif
country name is possible, but more complicated, since there are so many countries to accomodate (continent would be easier)<G>
--don
Robert
23rd January 2005, 08:51 AM
You could use Floris' code:
<img border="0" src="$post[fieldx].gif" />
which would then display either male.gif, female.gif, or undisclosed.gifThanks. Just to clarify. If I use Floris' code but replace the x with the field number e.g. 5. How does the system know which .gif image to pull?
When I create a custom field I specify with text what the options are and thus the system displays which one a user picks. Where do I specify which image coresponds to which option?
darnoldy
23rd January 2005, 12:19 PM
Thanks. Just to clarify. If I use Floris' code but replace the x with the field number e.g. 5. How does the system know which .gif image to pull?
Within the tag"
<img border="0" src="$post[fieldx].gif" />
$post[fieldx] is a variable that is replaced with value it contains. So, if the value of field x is "male", then the tag is constructed to read:
<img border="0" src="male.gif" />
and that image would display.
So you should name your images: male.gif, female.gif, or undisclosed.gif
--don