PDA

View Full Version : Add a "Has this already been asked?" Button


reteep
10 Oct 2005, 09:22
Add a "Has this already been asked?" Button

Adds a button besides the title when creating a new thread which executes a search query of the filled in words. This helps a bit preventing new users post questions which has already been asked in the past.

Author: Andreas Kraus - sunlab (http://www.sunlab.de) / Musiker-Board (http://www.musiker-board.de/vb)

Installation Instructions:

# Open the Admin Control Panel > Styles & Templates > Style Manager > New Posting Template Group > newthread template, and directly above </head>:

<script language="javascript">
<!--
function checktitle(theform) {
if(theform.subject.value==""){
alert("Please enter a topic in the subject field.");
return false; } else {
window.open('search.php?do=process&titleonly=1&query='+document.vbform.subject.value+'','javascript_1','toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width=700,height=400'); }
}
//-->
</script>

# now find this code inside newthread:


<td><input type="text" class="bginput" name="subject" value="$subject" size="40" maxlength="85" tabindex="1" /></td>
<td>&nbsp;&nbsp;</td>

# and replace with:


<td><input type="text" class="bginput" name="subject" value="$subject" size="40" maxlength="85" tabindex="1" /></td>
<td>&nbsp;<input type="button" class="button" value="Has this already been asked?" onClick="checktitle(vbform);"></td>

# Save the newthread template and you're done!

Enjoy :cool:

predatorkill
10 Oct 2005, 12:00
i ve installed this mod...the only problem is that the box "have this being asked before?" is not aligned correctly with the "Title" box.It appears slightly below the "Title" box...I think u are missing an align= command.I didnt tested it myself tho,i m not an expert in coding. :rolleyes:

please note that the part of the code:
<td><input type="text" class="bginput" name="subject" value="$subject" size="40" maxlength="85" tabindex="1" /></td>
<td>&nbsp;&nbsp;</td>

Cannot be found through the "Search in Template" in template editor.(admin cp)

I ve use firefox ctrl+f to find the lines.It found only <td><input type="text" class="bginput" name="subject" value="$subject" size="40" maxlength="85" tabindex="1" /></td> so there are some spaces missing betwen this and <td>&nbsp;&nbsp;</td> .

mod works perfectly tho!!!

Thanx!
*installed*

reteep
10 Oct 2005, 13:23
Hey there, thanks for your input.

For me it's perfectly aligned or are you talking about the slight 1px at the top? It looks better that way imo (like on the screenshot) but that's just about my taste ;)

hotrod1
10 Oct 2005, 15:06
Great idea, thanks!

predatorkill
10 Oct 2005, 15:11
below in the photo attached you can see what i mean...

MrNase
10 Oct 2005, 17:00
below in the photo attached you can see what i mean...


Just delete this &nbsp; found in


<td>&nbsp;<input type="button" class="button" value="Has this already been asked?" onClick="checktitle(vbform);"></td>



Author:
The first point of your instruction is wrong.. the code must be added after:

</head>

and before:

<body$onload>

predatorkill
10 Oct 2005, 19:11
problem solved,now it's aligned perfectly!!

thank you very much...

reteep
10 Oct 2005, 19:48
Thanks for the input! Changed the instructions. As for the &nbsp; -> on my forum it works :o

MrNase
10 Oct 2005, 20:34
Stupid me :(

I had a typo in my post.. It must go directly ABOVE </head> :D

nailerpa
11 Oct 2005, 00:20
Does the Search function work for everyone? I typed in, verbatim, the title of a previous post. The search function said that nothing was found with those words in the title. Am I missing something?

Steve A.
Site Admin, I.T. Help Community (http://www.ithelpcommunity.com)

reteep
11 Oct 2005, 06:21
Does the Search function work for everyone? I typed in, verbatim, the title of a previous post. The search function said that nothing was found with those words in the title. Am I missing something?

Steve A.
Site Admin, I.T. Help Community (http://www.ithelpcommunity.com)

By default it only searches the title. You can change that here:


window.open('search.php?do=process&titleonly=1&query='+document.vbform.subject.value+'','javascript_1','toolbar=no,location=no, directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no, width=700,height=400'); }


Just remove the &titleonly=1 to search the full posts.

Tony G
11 Oct 2005, 06:27
Please attach a text file with the instructions too. Thanks. :)

reteep
11 Oct 2005, 06:59
Please attach a text file with the instructions too. Thanks. :)

Ok, done..

rb290
13 Oct 2005, 17:55
When I click on it nothing happens....?

The Wise One
13 Oct 2005, 21:34
installed. thanks.

reteep
14 Oct 2005, 08:39
When I click on it nothing happens....?

Did you implent the JavaScript Code correctly?

mholtum
14 Oct 2005, 11:08
works great for me thanks!

Yahookan
18 May 2006, 00:07
Old but great.

:)

GamerJunk.net
20 May 2006, 19:20
Great idea

reteep
13 Jul 2006, 08:50
Just FYI: Tested on vB 3.6, running fine!

techartist1
08 Nov 2006, 22:20
great mod!

SoftDux
11 May 2007, 11:23
Great hack, thank you :)

ArchangelX
18 Aug 2007, 03:15
Great edit! I've changed my button to read "Search for similar topics?". Thanks!