Pikok |
02-16-2004 09:15 AM |
This should work..
- New Custom Field
Create a custom field in the AdminCP and take note of the field number. You can set it as radio buttons or a drop-down menu.. It's your preference. Either way, make the options: "Male" and "Female". Set to your preference if you want the field required (recommended), etc.
- Upload Files
You need to have the images you want to be displayed for each choice (i.e. male, female, unknown). Upload them to your miscellaneous images folder (i.e. "/images/misc"). Be sure that the filenames are "Male.ext", "Female.ext", and "Unknown.ext". If the filenames are different, either rename to what I listed or change the code to suit.
- Template Modification(s)
Open up whatever template you want the icon displayed in and add the following code where you want it to appear (be sure to set the appropriate field number and filenames/extensions):
PHP Code:
<if condition="$post[field7]">
<img src="$stylevar[imgdir_misc]/$post[field7].gif" alt="$post[field7]" border="0" />
<else />
<img src="$stylevar[imgdir_misc]/Unknown.gif" alt="Unknown" border="0" />
</if>
If you would rather have no image display for those who haven't specified male or female, or have it set to required.. You can simply remove the ELSE section of that code (2 lines). That way if the field is set, it will display, otherwise, nothing will be shown (and you don't need an unknown image either). ;)
Note: You'll need to change the variable "$post" as required to have it display in places other than the postbit.. But, I pust that as you said you wanted it by the avatar.
|