1

Topic: search box

Is there a way to include a quick search box in all the pages of the forum?
I've been using the txp forum for about a year and a half, and now that I'm starting my own forum I keep on thinking how the extra click to reach the search is some times pointless.

Re: search box

colak wrote:

...I keep on thinking how the extra click to reach the search is some times pointless.

Well, maybe not pointless. Surely the point is to get to search smile

But I agree it would be nice to have a little search box visible on each page. I've seen it done on various punBB boards, so its doable. Have you searched www.punres.org for a mod or hack?

Re: search box

See http://punbb.org/forums/viewtopic.php?pid=65031#p65031 for some basic code.

To put it on every page, you can use the pun_include directive in main.tpl, as described in the docs.

Looking for a certain modification for your forum? Please take a look here before posting.

4

Re: search box

pogenwurst wrote:

See http://punbb.org/forums/viewtopic.php?pid=65031#p65031 for some basic code.

To put it on every page, you can use the pun_include directive in main.tpl, as described in the docs.

hi pogenwurst
thanks for your reply and the link re code needed for the search. it looks ok but I'm yet to understand why I would have to use the pun_include (please do remember that I am very new at this smile ).



1. Do I need to paste/modify the search code in a new document, save it as a php file and then call it as described here in the main.tpl?

2. Do I just paste/modify the code in the main.tpl?

thanks in advance for your help

5 (edited by quaker 2006-06-07 20:02)

Re: search box

no php in main.tpl...hehehe...
it is all html.

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: search box

colak wrote:
pogenwurst wrote:

See http://punbb.org/forums/viewtopic.php?pid=65031#p65031 for some basic code.

To put it on every page, you can use the pun_include directive in main.tpl, as described in the docs.

hi pogenwurst
thanks for your reply and the link re code needed for the search. it looks ok but I'm yet to understand why I would have to use the pun_include (please do remember that I am very new at this smile ).



1. Do I need to paste/modify the search code in a new document, save it as a php file and then call it as described here in the main.tpl?

2. Do I just paste/modify the code in the main.tpl?

thanks in advance for your help

I'll have code for you in a bit, sit tight. smile

Looking for a certain modification for your forum? Please take a look here before posting.

Re: search box

Ok, simply open main.tpl, and placed the following code below <pun_announcement>:

<div id="punsearch" class="block">
    <h2><span>Forum Search - <a href="search.php">advanced</a></span></h2>
    <div class="box">
        <div class="inbox">
            <div>
                <form id="search" method="get" action="search.php">
                    <input type="hidden" name="action" value="search" />
                    <label class="conl">Search keywords: <input type="text" name="keywords" size="40" maxlength="100" /></label>
                    <input type="submit" name="search" value="Submit" accesskey="s" />
                </form>
            </div>
        </div>
    </div>
</div>

You can ignore what I said about pun_include, because when I wrote that I forgot that the code I linked to doesn't contain PHP, and thus can be placed directly in main.tpl.

Looking for a certain modification for your forum? Please take a look here before posting.

8 (edited by colak 2006-06-08 05:59)

Re: search box

pogenwurst
Many thanks, one small correction in your code to help with validation and for the sake of other people here who wish to follow your advice.
The problem with the original code was that it was producing duplicate ids in the advanced search as well as a validation error for label which needs to be wrapped in an element.

Here is how I use it in our forum.

<div class="block">
    <h2><span>Forum Search - <a href="search.php">advanced</a></span></h2>
    <div class="box">
        <div class="inbox">
            <div>
                <form class="search" method="get" action="search.php">
                    <p><input type="hidden" name="action" value="search" />
                    <label class="conl">Search keywords: <input type="text" name="keywords" size="40" maxlength="100" value="search" onblur="if (this.value == '') {this.value = 'search';}" onfocus="if (this.value == 'search') {this.value = '';}" /></label></p>
                </form>
                <div style="clear:both;"> </div>
            </div>
        </div>
    </div>
</div>

Re: search box

Cool, I just messed with the code I originally linked to; I didn't pass it through the validator or anything.

Looking for a certain modification for your forum? Please take a look here before posting.