PDA

View Full Version : PHP question...


Tailfeathers
07-29-2004, 06:44 AM
How would I put a specific image at the top of each forum (one different one for each forum)?

I assume I'd go to the forum template and put the code where I want the banner to show...the code would be like, if frm 50, show this image, if frm30, show this page, etc...

I'd assume the php for this would be pretty easy, but I'm clueless. :p

Colin F
07-29-2004, 07:34 AM
you can do that with template conditionals:
<if condition="forumid == 30">
//code for forum 30
</else><if condition="forumid == 31">
//code for forum 31
</if></if>

just do that for all the forums you have.

Dean C
07-29-2004, 09:08 AM
Easier still create a new directory in your images /misc/ folder and name the images based on the forumid. E.g. 1.gif (for forumid1) etc...

Then in the templates put:


<img src="$stylevar[imgdir_misc]/forumicons/$forumid.gif" border="0" alt="" />


Remember that'll output as a broken image if one forumid hasn't got an image :)

Andreas
07-29-2004, 09:15 AM
You can avoid the broken image if you put the following as .htaccess in your forumicons directory (only for Apache):


ErrorDocument 404 http://www.yoursite.tld/forums/clear.gif


:)

Dean C
07-29-2004, 09:41 AM
Nice workaround ;)

Modin
07-29-2004, 03:09 PM
nice tip Kirby :up:

Will be using that one :)

Tailfeathers
07-29-2004, 05:27 PM
Thanks, everyone. :D