Log in

View Full Version : Different "New Thread" graphic for each forum - without creating new templates


mike095
08-05-2003, 05:24 PM
In vbulletin 2.2.1, we want different "New Thread" graphics for each forum.

In the template called "forumdisplay_newthreadlink"

The original code shows

<a href="newthread.php?s=$session[sessionhash]&action=newthread&forumid=$foruminfo[forumid]">

<img src="{newthreadimage}" border="0" alt="Post New Thread"></a><br>

-----------------------------------------
How can we change the image tag to be dependent on the $foruminfo[forumid]

The could might be something like:

//------------------------------------------------------------;
switch($foruminfo[forumid])
{
case "84":
<img src="/images/image84.gif" border="0" alt="Post New Thread"></a><br>
break;
//--- break prevents the code from running other cases;
case "5":
<img src="/images/image5.gif" border="0" alt="Post New Thread"></a><br>
break;
case "3":
<img src="/images/image3.gif" border="0" alt="Post New Thread"></a><br>
break;
default:
<img src="{newthreadimage}" border="0" alt="Post New Thread"></a><br>
break;
}//-- end switch;

---------------------------------------------

but this doesn't work as an in-line script. Any ideas of a script that would switch out the button code based on the forum id?

Thanks in advance

Gary King
08-05-2003, 08:57 PM
Put this in the proper part of forumdisplay.phpswitch($foruminfo['forumid'])
{
case "84":
$newthreadimage="images/image84.gif";
break;
case "5":
$newthreadimage="images/image5.gif";
break;
case "3":
$newthreadimage="images/image3.gif";
break;
default:
$newthreadimage="images/reply.gif";
break;
}


Open up forumdisplay_newthreadlink template, and find{newthreadimage}

Replace it with $newthreadimage

mike095
08-05-2003, 10:55 PM
it worked - thanks !

Gary King
08-05-2003, 11:04 PM
No problem, glad I could help :)

sabret00the
08-06-2003, 12:13 AM
demo/ss?

Gary King
08-06-2003, 12:15 AM
It just changes your newthread button depending on which image you choose for which forumid.

Dean C
08-06-2003, 10:12 AM
The easiest thing to do here would be to to add a new field to the forum table :)

- miSt

sabret00the
08-07-2003, 04:35 AM
or edit the template

img src="newreply{forumid}.gif" :shrug:

Dean C
08-07-2003, 10:48 AM
^ The best idea i've heard all day ;)

* Mist wonders how he forgets the easy things like this

I think you may have to use a variable instead but that's a good principle - you'll have to make a new image for EVERY forum you have though unfortunately :)

- miSt

Gary King
08-07-2003, 02:48 PM
Yep that's why my way is still better :p

You can have an else statement, and you don't have to name your reply buttons your forumids ;)