• Welcome to Simple Machines Community Forum. Please login or sign up.

Search in mambo/smf-forums/coppermine-gallery

Started by bmwheaven, March 25, 2005, 03:46:38 PM

Previous topic - Next topic

bmwheaven

Here it is, the search function combined for mambo, smf and coppermine (in the mambo-wrapper component).
You can put this code in your mambo template (index.php).
You'll get a search box, together with a selection box, where you can select which part of the site you want to search on.

code (for in index.php in your mambo template):
NOTE: you have to add a wrapper in your com_wrapper admin, point it to http://yoursite.com/gallery/thumbnails.php and call it cpg_search

//put this in between the <head></head> tags
<script language="JavaScript">
<!--
function processForm()
{
f = document.searchform;
switch (f.searcharea.selectedIndex)
{
// mambo
case 0: f.method='post';
f.action='index.php?option=search';
break;
//smf
case 1: f.method='post';
f.action='index.php?option=com_smf&Itemid=51&action=search2';
f.search.value=f.searchword.value;
f.option.value="";
break;
//coppermine
case 2: f.method='get';
f.action='index.php?option=com_wrapper&wrap=cpg_search&album=search&type=full';
f.search.value=f.searchword.value;
f.option.value = "com_wrapper";
f.wrap.value = "cpg_search";
break;
}
f.submit();
}
-->
</script>

//put this in the place you want the searchbox to display
<form name='searchform' action='javascript:processForm()' method='post'>
            <div class="searchblock" id="searchblock">
              <input size="15" class="inputbox" type="text" name="searchword" style="width:128px;" value="search..."  onblur="if(this.value=='') this.value='search...';" onfocus="if(this.value=='search...') this.value='';" />
              <input type="hidden" name="option" value="search" />
  <input type="hidden" name="wrap" value="cpg_search" />  
  <!--cpg-->
  <input type="hidden" name="album" value="search" />
  <input type="hidden" name="search" />
  <!--end cpg-->
 
  <!--smf-->
  <input type="hidden" name="advanced" value="0" />
  <!--end smf-->
 
              <select name="searcharea">
                <option value = 0>Articles</option>
                <option value = 1>Forum</option>
                <option value = 2>Image Gallery</option>
              </select>
              <br>
              <input type="submit" value="GO" class="button" style="width:35px;" />
            </div>
          </form>



Hope I've told everything, you can always ask!
Thanks to Orstio for helping :)

Ilir
Sh*t happens
All the time

Janner

Presumably this line has to be changed to reflect the itemid of your own installation:

f.action='index.php?option=com_smf&Itemid=51&action=search2';

bmwheaven

Sh*t happens
All the time

deejayh

Hi,

Does this only work in a wrapped SMF Forum and wrapped Coppermine -  On my site they are UN-WRAPPED,

Dave
Regards,
Dave
Family History UK  - http://www.familyhistory.uk.com

jorgen

Could this be made an a mambo-module for easier installation?

And can it easily be customized for Mambo-smf only?

bmwheaven

Quote from: deejayh on April 05, 2005, 05:30:21 AM
Hi,

Does this only work in a wrapped SMF Forum and wrapped Coppermine -  On my site they are UN-WRAPPED,

Dave
You can modify them easily for an unwrapped coppermine, just change this line in case 2:
//coppermine
case 2: f.method='get';
f.action='index.php?option=com_wrapper&wrap=cpg_search&album=search&type=full';
f.search.value=f.searchword.value;
f.option.value = "com_wrapper";
f.wrap.value = "cpg_search";
break;

to
//coppermine
case 2: f.method='get';
f.action='/coppermine/thumbnails.php&album=search&type=full';
f.search.value=f.searchword.value;
f.option.value = "";
f.wrap.value = "cpg_search";
break;


for smf you have to search the values for the form, I don't know them...


Quote from: jorgen on April 05, 2005, 10:56:50 AM
Could this be made an a mambo-module for easier installation?

And can it easily be customized for Mambo-smf only?
customizing for mambo-smf only is easy, just delete (or comment out) the things you dont need, for example:
//put this in between the <head></head> tags
<script language="JavaScript">
<!--
function processForm()
{
f = document.searchform;
switch (f.searcharea.selectedIndex)
{
// mambo
case 0: f.method='post';
f.action='index.php?option=search';
break;
//smf
case 1: f.method='post';
f.action='index.php?option=com_smf&Itemid=51&action=search2';
f.search.value=f.searchword.value;
f.option.value="";
break;
}
f.submit();
}
-->
</script>

//put this in the place you want the searchbox to display
<form name='searchform' action='javascript:processForm()' method='post'>
            <div class="searchblock" id="searchblock">
              <input size="15" class="inputbox" type="text" name="searchword" style="width:128px;" value="search..."  onblur="if(this.value=='') this.value='search...';" onfocus="if(this.value=='search...') this.value='';" />
              <input type="hidden" name="option" value="search" />
  <!--smf-->
  <input type="hidden" name="advanced" value="0" />
  <!--end smf-->
 
              <select name="searcharea">
                <option value = 0>Articles</option>
                <option value = 1>Forum</option>
              </select>
              <br>
              <input type="submit" value="GO" class="button" style="width:35px;" />
            </div>
          </form>


This should work...
Didn't test it though, let me know

Owh, and to the question if this could be made a module, probably it could, but really don't know how exactly...
Sh*t happens
All the time

deejayh

Hi,

I have the normal Mambo search in my index.php.
I would like to add an "advanced Search" link to go to a "static page" where this code would go to search:
1)  Mambo
2) SMF
3) some other components (such as "classifieds") which do not yet have a mambot search!

Could this be achieved?

Regards,
Dave
Regards,
Dave
Family History UK  - http://www.familyhistory.uk.com

bmwheaven

You can create a custom page in mambo, and put in the search code I used for the module...
You can use a static content page, and paste in the html/javascript code provided, shouldn't be too difficult.
Sh*t happens
All the time

deejayh

Hi bmwheaven,

Do you mean the module that is in the bridge files?

Dave
Regards,
Dave
Family History UK  - http://www.familyhistory.uk.com

Kindred

Actually, Adding your code into the search module does not work....

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

bmwheaven

Nope, I meant adding the code into a seperate file, through your admin, select Content->Static Content Manager
Then add new, and put the code in there...
On the right side you can make a direct link (Link to Menu), so that the link to this search page will be displayed in the menu you choose.
Hope this helps, I really gotta get some sleep.
nn
Sh*t happens
All the time

deejayh

Sorry to trouble you again!

What about a SMF search Mambot?

So it would be a straight forward search.
It seems there are loads of people adding search mambots for their components.

I would not know where to start though! :)

Just a thought!
Dave
Regards,
Dave
Family History UK  - http://www.familyhistory.uk.com

bmwheaven

Hey Dave,
it sounds really good, I know.. but I really don't have the time to build it, and don't know how to (yet)...
Maybe someone else would like to look into it?
Sh*t happens
All the time

deejayh




anyone willing to have a go at this?

Upto the challenge?
Regards,
Dave
Family History UK  - http://www.familyhistory.uk.com

Radianation

I too am looking for integrated search in mambot form.

d3v

Did anyone ever pick this up?
SMF Searchbot for Mambo sounds soooo good  :P

d3v

I swear I saw something like that on one of the Mambo sites. Am I day dreaming or such a thing exists in nature? Thank you.

I refer to just Mambo-SMF search bot. not Coppermine

bmwheaven

I haven't got a clue....
I just wrote it, because I didn't find anything that suited my needs....
Sh*t happens
All the time

chadness

Ideally it would be two different bots.  One for SMF, one for Coppermine.  No need to mix them - then people can just install what they need.

d3v

Is it possible to make this without the dropdown box (Articles/Forum) but rather just one search box that would search both and show results for both on the same page? Thank you.

Advertisement: