Welcome, Guest. Please Login or Register.
November 26, 2024, 01:34:34 AM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  English User Help  |  English Help  |  simple search in every page of the forum? « previous next »
Pages: [1] Reply Ignore Print
Author Topic: simple search in every page of the forum?  (Read 366 times)
luiscamino
Noobie
*
Posts: 47


clubsonyericsson.com director and producer

simple search in every page of the forum?
« on: September 30, 2003, 09:45:32 AM »
Reply with quote

YaBB SE Version: 1.5.4
PHP Version:
MySQL Version:
Server Platform:
Link to Forum: http://foro.clubsonyericsson.com

Problem Description:
could some advanced yabbse user try to integrate a simple search form (text field and search button) in the template so users ALWAYS see the search form instead of just a tiny image they always ignore driving us administrators mad?

perhaps there's already a mod for this?
Logged
luiscamino
Noobie
*
Posts: 47


clubsonyericsson.com director and producer

Re:simple search in every page of the forum?
« Reply #1 on: October 06, 2003, 10:49:03 PM »
Reply with quote

i have used the search but i'm afraid i haven't found anything...
Logged
Peter Duggan
Llama Chameleon
Global Moderator
YaBB God
*****
Posts: 1793


You come and go...

WWW
Re:simple search in every page of the forum?
« Reply #2 on: October 06, 2003, 11:44:43 PM »
Reply with quote

If you want a really lazy hack, visit your own forum, enable simple search, click your search button, view source, copy the search form and stick it in your template.

It's neither elegant nor smart, but it works and it doesn't mess up anything else!
Logged

Peter Duggan
Llama Chameleon
Global Moderator
YaBB God
*****
Posts: 1793


You come and go...

WWW
Re:simple search in every page of the forum?
« Reply #3 on: October 06, 2003, 11:57:51 PM »
Reply with quote

Tidier version:

<form action="index.php?action=search2" method="post">      
   <table width="80%" border="0" cellspacing="1" cellpadding="4" align="center" bgcolor="#6394BD" class="bordercolor">
      <tr>
         <td bgcolor="#AFC6DB" class="windowbg">
            <font size="2">
               <b>Search for:</b><br />
               <input type="text" name="search" size="40" />&nbsp;
               <input type="submit" name="submit" value="Search" /><br />
               <a href="index.php?action=search;advanced=1">Advanced search</a>
               <input type="hidden" name="advanced" value="0" />
            </font>
         </td>
      </tr>
   </table>
</form>


Note that, amongst other bits not needed for this purpose, I've removed:

name="searchform" id="searchform"

So a duplicate 'id' won't stop the main search page validating!
Logged

Peter Duggan
Llama Chameleon
Global Moderator
YaBB God
*****
Posts: 1793


You come and go...

WWW
Re:simple search in every page of the forum?
« Reply #4 on: October 07, 2003, 12:04:52 AM »
Reply with quote

If you also want to lose the 'search' button, search Subs.php for:

   $yymenu = "<a href=\"$scripturl\">$img[home]</a>$menusep<a href=\"$helpfile\" target=\"_blank\">$img[help]</a>$menusep<a href=\"$cgi;action=search\">$img[search]</a>";

And replace with:

   $yymenu = "<a href=\"$scripturl\">$img[home]</a>$menusep<a href=\"$helpfile\" target=\"_blank\">$img[help]</a>";
Logged

luiscamino
Noobie
*
Posts: 47


clubsonyericsson.com director and producer

Re:simple search in every page of the forum?
« Reply #5 on: October 07, 2003, 12:10:58 AM »
Reply with quote

thank you so much!  ;)
Logged
Peter Duggan
Llama Chameleon
Global Moderator
YaBB God
*****
Posts: 1793


You come and go...

WWW
Re:simple search in every page of the forum?
« Reply #6 on: October 07, 2003, 02:18:47 AM »
Reply with quote

Quote from: Peter Duggan on October 06, 2003, 11:44:43 PM
It's neither elegant nor smart, but it works and it doesn't mess up anything else!

Here's a better version that actually uses the forum colours and language files. Please note that, although it's been tested on my own server, I've never offered a proper mod (as opposed to hack) before so you use the code entirely at your own risk!

<file>
Sources/Subs.php
</file>

<search>
   global $yytemplate, $yyboardname, $yytitle, $yyuname, $yyim, $yytime, $yymenu, $yymain, $yycopyright;
   global $yynews, $menusep, $enable_notification, $enable_news, $username, $db_prefix, $locale, $boarddir;
   global $maintenance, $txt, $mbname, $date, $settings, $cgi, $img, $scripturl, $helpfile, $realname, $yyheaderdone;
   global $yycopyin, $yytemplatemain, $yytitle, $yyVBStyleLogin, $timeformatstring, $timeoffset, $modSettings, $imagesdir;
   global $mnum, $munred, $ID_MEMBER;
</search>

<add>
   global $yypermasearch;
</add>

<search>
   $yymenu = "<a href=\"$scripturl\">$img[home]</a>$menusep<a href=\"$helpfile\" target=\"_blank\">$img[help]</a>$menusep<a href=\"$cgi;action=search\">$img[search]</a>";
</search>

<replace>
   $yypermasearch = '
      <form action="index.php?action=search2" method="post">      
         <table border="0" cellspacing="1" cellpadding="4" align="center" bgcolor="' . $color['bordercolor'] . '" class="bordercolor">
            <tr>
               <td bgcolor="' . $color['windowbg'] . '" class="windowbg">
                  <font size="2">
                     <b>' . $txt[582] . ':</b><br />
                     <input type="text" name="search" size="40" /> 
                     <input type="submit" name="submit" value="' . $txt[182] . '" /><br />
                     <a href="index.php?action=search;advanced=1">' . $txt['yse298'] . '</a>
                     <input type="hidden" name="advanced" value="0" />
                  </font>
               </td>
            </tr>
         </table>
      </form>';

   $yymenu = "<a href=\"$scripturl\">$img[home]</a>$menusep<a href=\"$helpfile\" target=\"_blank\">$img[help]</a>";
</replace>


Then remove the search form (as described in Reply #3) from your template and stick this in instead:

<yabb permasearch>

Where you want the permanent search box.

<edit>Discovered and replaced an errant windowbg3!</edit>

<edit>And a space that shouldn't have been included as part of the button text!</edit>
« Last Edit: October 07, 2003, 03:37:58 AM by Peter Duggan » Logged

Pages: [1] Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  simple search in every page of the forum? « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.045 seconds with 21 queries.