vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Search This Thread box (https://vborg.vbsupport.ru/showthread.php?t=223170)

Welshy2008 09-14-2009 03:04 PM

Search This Thread box
 
1 Attachment(s)
Hi All,

I am looking for a "Search this thread box" that I can physically put at the top and bottom of my forum.

The drop down menu one is getting overlooked by my users.

I am looking at putting a table? around the box and for me to be able to add some text (Title and a little write up about it) and then Place the "Search (this THREAD) box along with a 'Go' or Search button at the side of it.

I am new to it all and would be grateful if some one would tell me what code I need and where to put it please?

I would only like this on one or two selected Threads/forums - So would this be possible too please?

Many Thanks.

PS. I have attached screen shots of where I would like them positioned.

I would be happy with the standard vB table, Title in the Blue border, with a little desciption below. (Please bear in mind that I only want these to show in Select threads. Is it possible to do them based on a thread ID for example, please?

Welshy2008 09-16-2009 04:30 PM

Do you know what I mean? :)

James Birkett 09-16-2009 04:33 PM

Search threads?

What does this accomplish that Ctrl + F doesn't? :confused:

Welshy2008 09-16-2009 04:43 PM

Not all my members are familiar with short cuts like that and it would look more professional to have it as I have described. Even though there is one via the drop down menu (That always gets over looked).

--------------- Added [DATE]1253133912[/DATE] at [TIME]1253133912[/TIME] ---------------

Forgot to add that CTRL & F only searches the page that you are looking at - I need it to search the whole of a given thread. :)

Welshy2008 09-18-2009 06:17 AM

Forgot to mention that I am running vB 3.8.1 PL1

Lynne 09-18-2009 02:51 PM

Have you tried just copying the form for the Search this Thread that is currently displayed on the page? (Give the other forms a unique id, of course.)

Welshy2008 09-19-2009 11:20 AM

I haven't a clue on how to do what you suggest, Lynne.

If you have the patients and time to explain on here (So everyone can benefit) then I would be grateful.

:)


Thank You.

--------------- Added [DATE]1253363250[/DATE] at [TIME]1253363250[/TIME] ---------------

Code:

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat">
                <if condition="$show['searchthread']">$vbphrase[search_thread] - <a href="showthread.php?$session[sessionurl]t=$threadinfo[threadid]">$threadinfo[title]</a><else />$vbphrase[search_forums]</if>
        </td>
</tr>
<tr>
        <td class="panelsurround" align="center">

        <table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
        <tr>
                <td align="$stylevar[left]" valign="top" width="50%">
                        <fieldset class="fieldset" style="margin:0px">
                                <legend>$vbphrase[search_by_key_word]</legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                                <tr>
                                        <td colspan="2">
                                                <div>$vbphrase[key_words]:</div>
                                                <div><input type="text" class="bginput" name="query" size="35" value="$query" style="width:250px" /></div>
                                        </td>
                                </tr>
                                <if condition="!$show['searchthread']">
                                <tr>
                                        <td>
                                                <select name="titleonly">
                                                        <option value="0" $titleonlyselected[0]>$vbphrase[search_entire_posts]</option>
                                                        <option value="1" $titleonlyselected[1]>$vbphrase[search_titles_only]</option>
                                                </select><if condition="$show['nocache']"> <label for="cb_nocache"><input type="checkbox" name="nocache" value="1" id="cb_nocache" />$vbphrase[do_not_use_cached_results]</label></if>
                                        </td>
                                </tr>
                                </if>
                                </table>
                        </fieldset>
                </td>

--------------- Added [DATE]1253363434[/DATE] at [TIME]1253363434[/TIME] ---------------

I believe that is what I need, Yes?

I would like it to search and show individual posts please. What would I need to do and where do I place this code please?

Would it be possible to add this just to search the whole thread that I need it for? To search thread ID34212 for example.

--------------- Added [DATE]1253363846[/DATE] at [TIME]1253363846[/TIME] ---------------

I have scaled it down to this:

Code:

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat">
                <if condition="$show['searchthread']">$vbphrase[search_thread] - <a href="showthread.php?$session[sessionurl]t=$threadinfo[threadid]">$threadinfo[title]</a><else />$vbphrase[search_forums]</if>
        </td>
</tr>
<tr>
        <td class="panelsurround" align="center">

        <table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
        <tr>
                <td align="$stylevar[left]" valign="top" width="50%">
                        <fieldset class="fieldset" style="margin:0px">
                                <legend>Search this thread</legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                                <tr>
                                        <td colspan="2">
                                                <div>Please enter any search word, Ie: Name, Address, Post Code etc:</div>
                                                <div><input type="text" class="bginput" name="query" size="35" value="$query" style="width:250px" /></div>
                                        </td>
                                </tr>
                                <if condition="!$show['searchthread']">
                                <tr>
                                        <td>

                                                </select> </label></if>
                                        </td>
                                </tr>
                                </if>
                                </table>
                        </fieldset>
                </td>


Would this work Lynne? I can't see to actually enter the unique ThreadID of the only thread that I would like this to work on?

Is the above code correct to search a thread and show the actual posts, Please?



Many Thanks.

--------------- Added [DATE]1253365168[/DATE] at [TIME]1253365168[/TIME] ---------------

Scrap the above codes... What do you think of the following...

Code:

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="tcat">
               
        </td>
</tr>
<tr>
        <td class="panelsurround" align="center">

        <table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
        <tr>
                <td align="$stylevar[left]" valign="top" width="50%">
                        <fieldset class="fieldset" style="margin:0px">
                                <legend>Search this thread</legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                                <tr>
                                        <td colspan="2">
                                                                                <tr>
<form action="search.php?do=process&searchthreadid=5" method="post">
        <table cellpadding="4" cellspacing="1" border="0">
        <tr>
                <td class="thead">Please enter any search word, Ie: Name, Address, Post Code etc:<a name="goto_threadsearch"></a></td>
        </tr>
        <tr>
                <td class="vbmenu_option" title="nohilite">
                        <input type="hidden" name="s" value="" />
                        <input type="hidden" name="securitytoken" value="9-fe0c255" />
                        <input type="hidden" name="do" value="process" />
                        <input type="hidden" name="searchthreadid" value="5" />
                        <input type="text" class="bginput" name="query" size="25" /><input type="submit" class="button" value="Go"  /><br />
                </td>
        </tr>
        <tr>
                        </tr>
        </table>
</form>

                                        <td>

                                                </select> </label></if>
                                        </td>
                                </tr>
                                </if>
                                </table>
                        </fieldset>
                </td>


Where would I place this, just to search the threadID that I will correct, to the one that I need (The one now '5' is an example).

I need it to show on all the current pages and any future pages too. (top and bottom). Where would I place the code please?


Many Thanks.

Lynne 09-19-2009 02:21 PM

Your code is a bit different from mine. This is from my SHOWTHREAD template. This is the part you see in the top bar - it's just basic javascript to create the dropdown (in the same manner dropdowns are made in the navbar):
HTML Code:

    <if condition="$show['search']">
        <td class="vbmenu_control" id="threadsearch" nowrap="nowrap">
            <a href="$show[nojs_link]#goto_threadsearch">$vbphrase[search_this_thread]</a>
            <if condition="$show['popups']"><script type="text/javascript"> vbmenu_register("threadsearch"); </script></if>
        </td>
    </if>

Then, near the bottom of the template is the drop down part with the form:
HTML Code:

<if condition="$show['search']">
<!-- thread search menu -->
<div class="vbmenu_popup" id="threadsearch_menu" style="display:none">
<form action="search.php?do=process&amp;searchthreadid=$threadid" method="post">
    <table cellpadding="4" cellspacing="1" border="0">
    <tr>
        <td class="thead">$vbphrase[search_this_thread]<a name="goto_threadsearch"></a></td>
    </tr>
    <tr>
        <td class="vbmenu_option" title="nohilite">
            <input type="hidden" name="s" value="$session[sessionhash]" />
            <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
            <input type="hidden" name="do" value="process" />
            <input type="hidden" name="searchthreadid" value="$threadid" />
            <input type="text" class="bginput" name="query" size="25" />$gobutton<br />
        </td>
    </tr>
    <tr>
        <td class="vbmenu_option"><a href="search.php?$session[sessionurl]searchthreadid=$threadid">$vbphrase[advanced_search]</a></td>
    </tr>
    </table>
</form>
</div>
<!-- / thread search menu -->
</if>

If you don't want the dropdown, then you can just use the form in the second code portion. You'll have to format it how you want. It looks like it doesn't have a form id you need to change, but you can't leave that div id the same - threadsearch_menu. Of course, get rid of the display:none stuff, but when you reformat it, I'm sure you will. You'll have to just play with it, I'd guess.

Welshy2008 09-19-2009 07:08 PM

Thanks Lynne.

How would I actually find the Template (If that is the correct word) of the forum that I need to add it to, And where would I need to place that code in order to have it in the correct positions as my two Attachments in my OP Please?

Many Thanks.

James Birkett 09-19-2009 07:17 PM

Admin CP -> vBulletin Options -> General Settings -> Add Template Name in HTML Comments -> Yes

Welshy2008 09-19-2009 07:37 PM

Thanks James, Just tried that and there are so many templates in the "View Source" - I haven't clue which one it is.

Out of curiosity, I tried my last code, above - and when I clicked on go - it said token Expired. When I removed the token part - it didn't work either. How would I correct that please? (I tried the second of Lynne's codes too - but it didn't work).

I tried mine in the footer - as I knew where that was.

Lynne 09-19-2009 07:43 PM

I think you want it in the SHOWTHREAD template. That's what you said at first anyway.

Welshy2008 09-19-2009 07:48 PM

Quote:

Originally Posted by Welshy2008 (Post 1887703)
Thanks James, Just tried that and there are so many templates in the "View Source" - I haven't clue which one it is.

Out of curiosity, I tried my last code, above - and when I clicked on go - it said token Expired. When I removed the token part - it didn't work either. How would I correct that please? (I tried the second of Lynne's codes too - but it didn't work).

I tried mine in the footer - as I knew where that was.



Sorted that part - I added "$bbuserinfo[securitytoken]".

All I need to do now is suss out the right template and place to add it.

Lynne 09-19-2009 07:51 PM

Don't go using the form code from your source code, you need to have the vbulletin variables in there like in the form code I posted or this isn't going to work.

Welshy2008 09-19-2009 07:56 PM

Quote:

Originally Posted by Lynne (Post 1887708)
I think you want it in the SHOWTHREAD template. That's what you said at first anyway.

Hi Lynne,

If I do it that way, The search box will show in all Threads of every forum. I would like it to show in a certain forum Only. Is that possible please?


Many Thanks.

Lynne 09-19-2009 10:33 PM

Put a condition around it to say if in forum x show this....

Welshy2008 09-20-2009 07:39 AM

I am new to all this Lynne, I really haven't a clue as to do all that. :(

I tried my code last night and it worked. All I have to do is work out where to place it, to get it in the one thread, but on the top and bottom of every page within that thread.


If you have the time and patience, I would appreciate your help with the code of which you speak.

Thanks, Once again.

Mark.B 09-20-2009 09:16 AM

I did have a crack at this just now but found that I was getting "you did not select any posts to which the specified action can be applied" which suggests it's muddling up the "go" button with the one from the moderation dropdown.

I think this has has to do with forms. Not sure if there's a way round that to place it where you want. All the variables seem to be passed correctly as the thread ID was in the source code.

Welshy2008 09-20-2009 10:26 AM

Afternoon Mark.

Thank You for trying - I appreciate it.

I have the code Working. And it searches too. Both my code and that, that Lynne kindly supplied (I tweaked it a little to work.).

I just wanted a border around it with the rounded off edges. I acheived this but dark backgrounds appear around the title and description, like that of the vBulletin standard.

I have to sytles - 1 where the style is 'Live' and a default style too.

I haven't a clue how to or what I need to type into the address bar for the default style, as this is the one that I want to test my code(s) on without actually touching the 'Live' forum.

Any ideas as to what I need to type to view the default one? ie: http://www.myforum.com/default sytle?


Many Thanks.


PS. I had a go at positioning it at various points throught the "SHOWTHREAD" - But it just messed the layout of it up. (Again this is why I should do it on a practice forum such as my Default one - If only I knew the address or how to actually view the default one to actually view the forum as if it were live).

--------------- Added [DATE]1253446087[/DATE] at [TIME]1253446087[/TIME] ---------------

** EDIT **

PS Mark, On the one that I did - I actually used the correct threadID, in order to be searched. It did work too. :)

Mark.B 09-20-2009 11:46 AM

I've worked out the problem...I can make it work for ordinary members, but for anyone with moderating permissions in that thread, the FORM for the search is nested within the FORM for the moderator actions (if you put it next to the postbit controls).

Welshy2008 09-20-2009 11:53 AM

1 Attachment(s)
The code below is the code that I did/used.

The "Red" is the Threadid (example) and the "Green" is the Title and Description. (Again, an example).

I have also added a screenshot of what they look like in my HTML Practice and of what they actually look like on the forum. (ATTACHMENTS).



Code:

<tr>
        <td class="panelsurround" align="center">

        <table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
        <tr>
                <td align="$stylevar[left]" valign="top" width="50%">
                        <fieldset class="fieldset" style="margin:0px">
                                <legend><b>Search For a Friend (Example Only)</b></legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                                <tr>
                                        <td colspan="2">
                                                                                <tr>

<form action="search.php?do=process&searchthreadid=5430" method="post">
        <table cellpadding="4" cellspacing="1" border="0">
        <tr>
                <td class="thead">Please enter any search word, Ie: Name, Nick Name, Address, Post Code (Example Only):<a name="goto_threadsearch"></a></td>
        </tr>
        <tr>
                <td class="vbmenu_option" title="nohilite">
                        <input type="hidden" name="s" value="$session[sessionhash]" " />
                        <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
                        <input type="hidden" name="do" value="process" />
                        <input type="hidden" name="searchthreadid" value="5430" />
                        <input type="text" class="bginput" name="query" size="25" /><input type="submit" class="button" value="Go"  /><br />
                </td>
        </tr>
       
        </table>
</form>
</select></label>
                </tr>
                </fieldset>


And this is the code that I used of Lynnes. (BOTH work).


Code:

<tr>
        <td class="panelsurround" align="center">

        <table class="panel" cellpadding="0" cellspacing="$stylevar[formspacer]" border="0" width="100%">
        <tr>
                <td align="$stylevar[left]" valign="top" width="50%">
                        <fieldset class="fieldset" style="margin:0px">
                                <legend><b>Search For Friend (Example Only)</b></legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                                <tr>
                                        <td colspan="2">

<tr>
<form action="search.php?do=process&searchthreadid=5430" method="post">
    <table cellpadding="4" cellspacing="1" border="0">
    <tr>
        <td class="thead">Please enter any search word, Ie: Name, Nick Name, Address, Post Code (Example Only):<a name="goto_threadsearch"></a></td>
    </tr>
    <tr>
        <td class="vbmenu_option" title="nohilite">
            <input type="hidden" name="s" value="$session[sessionhash]" />
            <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
            <input type="hidden" name="do" value="process" />
            <input type="hidden" name="searchthreadid" value="5430" />
            <input type="text" class="bginput" name="query" size="25" />$gobutton<br />
        </td>
    </tr>
    </table>
</form>
</div>
</select></label>
                </tr>
                </fieldset>



By having a further bit of trial and error I got rid of on of the tales and one of the horrid blue backgrounds. I have the one left to do around the searchbox and go button. (See attachment) Any Idea how I remove that Please?


Code:

<tr>
        <td class="panelsurround" align="center">

       
        <tr>
                <td align="$stylevar[left]" valign="top" width="50%">
                                <fieldset class="fieldset" style="margin:0px">
                                <legend><b><font size="3">Search For a Friend</font></b></legend>
                                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                                <tr>
                                        <td colspan="2">
                                                                                <tr>

<form action="search.php?do=process&searchthreadid=5430" method="post">
        <table cellpadding="4" cellspacing="1" border="0">
        <tr>
                <td class=""><b><font size="2">Please enter Name, Nickname, Address, Post Code etc (Example Only):</font></b><a name="goto_threadsearch"></a></td>
        </tr>
        <tr>
                <td class="vbmenu_option" title="nohilite">
                        <input type="hidden" name="s" value="$session[sessionhash]" " />
                        <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
                        <input type="hidden" name="do" value="process" />
                        <input type="hidden" name="searchthreadid" value="5430" />
                        <input type="text" class="bginput" name="query" size="25" /><input type="submit" class="button" value="Go"  /><br />
                </td>
        </tr>
       
        </table>
</form>
</select></label>
                </tr>
                </fieldset>


Welshy2008 09-20-2009 11:54 AM

** EDIT **

After all that - I am receiving the "Token" message again. Strange.

Lynne 09-20-2009 02:48 PM


Welshy2008 09-20-2009 03:21 PM


Mark.B 09-20-2009 04:09 PM


Welshy2008 09-20-2009 04:43 PM


Lynne 09-20-2009 05:24 PM


Welshy2008 09-20-2009 05:32 PM


Lynne 09-20-2009 05:35 PM

Post what you've done. Post your code with about five lines of the default code above and below what you added. Let us know what template you added this to also.

Mark.B 09-20-2009 05:53 PM


Welshy2008 09-21-2009 06:50 AM

1 Attachment(s)

Mark.B 09-21-2009 10:25 AM


Welshy2008 09-21-2009 10:30 AM


Lynne 09-21-2009 03:10 PM


Mark.B 09-21-2009 04:18 PM

I've got to admit, I've slightly lost track of what you're trying to do now. I was under the impression you'd got the search box to work using the code I put in earlier, which is basically Lynne's without the formatting.

If that's the case, then you need to start with that as a core and work your way through styling it how you want, just as with normal code. If you're putting it to the right of the postbit controls (the Post Reply button nasically) then it'll probably need to sit in <td> tags. The <form> tags, I think, will have to go outside of that. You may then find you need to make the <td> that the Post Reply button sits in have a width, otherwise it will spread across the page and push your search box over.

If on the other hand you want the search box on a different line to the postbit controls, none of that is needed.

The blue background must be coming from the background class it is sitting in, if you put it in <td> tags try adding a class such as alt1 or even page.

This is probably going to boil down to you posting a screenshot of your page, highlighting where you want the box, and then posting that part of your SHOWTHREAD template so we can give some pointers as to where to put it.

Welshy2008 09-21-2009 04:38 PM


Lynne 09-21-2009 09:33 PM


Welshy2008 09-22-2009 07:37 AM


Lynne 09-22-2009 02:38 PM


Welshy2008 09-23-2009 07:45 AM



All times are GMT. The time now is 09:20 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01458 seconds
  • Memory Usage 1,901KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (2)bbcode_html_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete