View Full Version : Post New Thread Redirect for one forum
PKRWUD
08-19-2004, 09:12 AM
Greetings,
I'm really not sure how to title this request, but I will try my best to explain what I'm trying to do. I have a dozen or so forums on my website, and in each one, when you select New Thread, it takes you to newthread.php. What I would like is to be able to change that for one of the forums, so that when someone clicks on the New Thread button, they are instead sent to a different php file. The reason being that for one specific forum, I am trying to install a form that would have to be filled out every time someone wants to start a new thread. I have everything set up, but I can't figure how to change the address for the New Thread button in just one specific forum. I hope this makes sense. If I didn't explain this well enough, please ask any questions, and I will do my best to answer them. I am currently running 3.0.0.
TIA!!!
Take care,
~Chris
AN-net
08-19-2004, 03:10 PM
use a condition;)
<a <if condition="$f==xx">href="newfilehere.php"<else />href="newthread.php"</if>>New Thread</a>
that would be an example;)
PKRWUD
08-19-2004, 03:20 PM
Okay, I'm not real bright when it comes to this stuff. I understand the concept of what you're saying, but I don't know what to change in your example to make it work for me, other than changing the file name. What would I put where you wrote $f==xx? What else would I need to do? I feel very close to solving this. Thank you for your help!
PKRWUD
08-19-2004, 03:23 PM
Oh, wait, I think I get it. I should enter the forum number there, yes? It's f=53, so would I just write it as $f=53, or do I need two equals signs?
Admin
08-19-2004, 03:47 PM
You need two equal signs, since that is how you compare elements in PHP. So $f == 53 it is.
PKRWUD
08-19-2004, 04:02 PM
Okay, that makes sense. Hopefully this will be my last question... Below is the part of the file where the link is created for the new Thread button. Where would I substitute the code above into this?
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-top:3px">
<tr valign="top">
<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?$session[sessionurl]do=newthread&f=$foruminfo[forumid]"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else /> </if></td>
<if condition="$pagenav"><td align="$stylevar[right]">$pagenav</td></if>
</tr>
</table>
Admin
08-19-2004, 04:32 PM
Well, here is the link:
<a href="newthread.php?$session[sessionurl]do=newthread&f=$foruminfo[forumid]">
So that's what you want to change. I'd replace it with this:
<a href="<if condition="$foruminfo['forumid'] == 53">otherfile.php<else />newthread.php?$session[sessionurl]do=newthread&f=$foruminfo[forumid]</if>">
PKRWUD
08-19-2004, 11:22 PM
Thank you so much for your help! I will give this a try right away, and let you know how it goes.
Thanks again!
Take care,
~Chris
PKRWUD
08-19-2004, 11:29 PM
Okay, when I tried to do that, I received this warning...
The following error occurred when attempting to evaluate this template:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/pkrwud/public_html/vbulletin/includes/adminfunctions_template.php(3037) : eval()'d code on line 124
This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
PKRWUD
08-19-2004, 11:40 PM
Nevermind. Somehow I managed to change the code, but forgot to close the 'if'. I've corrected this, and it works excellent! I thank you very, very much for your time and assistance!
Take care,
~Chris
PKRWUD
08-23-2004, 06:57 PM
If you're still there, I have one more question. How do I write it for multiple conditions? For example, lets say I have two files I want it to redirect to, depending on where the member is. I thought using an elseif would work, but it didn't.
Any thoughts?
Admin
08-23-2004, 07:23 PM
This doesn't work?
<a href="<if condition="$foruminfo['forumid'] == 53">otherfile.php<else /><if condition="$foruminfo['forumid'] == 43">differentfile.php<else />newthread.php?$session[sessionurl]do=newthread&f=$foruminfo[forumid]</if></if>">
You can add as many conditions as you want:
<a href="<if condition="$foruminfo['forumid'] == 53">otherfile.php<else /><if condition="$foruminfo['forumid'] == 43">differentfile.php<else /><if condition="$foruminfo['forumid'] == 25">barfile.php<else /><if condition="$foruminfo['forumid'] == 3">foofile.php<else />newthread.php?$session[sessionurl]do=newthread&f=$foruminfo[forumid]</if></if></if></if>">
If it's a bit confusing reading the manual won't hurt. :)
http://www.vbulletin.com/docs/html/main/template_conditionals
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.