Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
User Documentation and How To's:
Advance Search - Multiple Fields
Douglas
Jamroom Team


Joined: 08 Oct 2004
Posts: 6639
Location: Tornado Alley!

Posted: 06/10/08 05:41 
There have been a few requests for multiple search fields, I'll try my best to show how to accomplish this... however this will only cover the artist search areas. You should be able to use this on other search areas ie. song, video etc. but you'll have to modify the search areas.

First you'll want to create your advanced search file named advanced_search.tpl and add this to it.

advanced_search.tpl:


Code

{if isset($search_area) && is_array($search_area)}

  {foreach from=$search_area key="num" item="s_area"}

    {if $s_area == "band_name" && strlen($search_string.$num) > 1}
      {jr_array name="_searcharea" key="0" value="band_name"}
      {jr_array name="_searchstring" key="0" value=$search_string.$num}

    {elseif $s_area == "band_members" && strlen($search_string.$num) > 1}
      {jr_array name="_searcharea" key="1" value="band_members"}
      {jr_array name="_searchstring" key="1" value=$search_string.$num}

    {elseif $s_area == "band_influence" && strlen($search_string.$num) > 1}
      {jr_array name="_searcharea" key="2" value="band_influence"}
      {jr_array name="_searchstring" key="2" value=$search_string.$num}

    {elseif $s_area == "band_soundlike" && strlen($search_string.$num) > 1}
      {jr_array name="_searcharea" key="3" value="band_soundlike"}
      {jr_array name="_searchstring" key="3" value=$search_string.$num}

    {elseif $s_area == "band_location" && strlen($search_string.$num) > 1}
      {jr_array name="_searcharea" key="4" value="band_location"}
      {jr_array name="_searchstring" key="4" value=$search_string.$num}

    {/if}

  {/foreach}

{/if}


<form method="post" action="{$JAMROOM_URL}/index.php">
<input type="hidden" name="template" value="advanced_search.tpl">

<input type="hidden" name="search_area[0]" value="band_name">
Artist Name: <input type="text" name="search_string[0]" style="width:195px">

<input type="hidden" name="search_area[1]" value="band_members">
Members: <input type="text" name="search_string[1]" style="width:195px">

<input type="hidden" name="search_area[2]" value="band_influence">
Influences: <input type="text" name="search_string[2]" style="width:195px">

<input type="hidden" name="search_area[3]" value="band_soundlike">
Artist Genre: <input type="text" name="search_string[3]" style="width:195px">

<input type="hidden" name="search_area[4]" value="band_location">
Location: <input type="text" name="search_string[4]" style="width:195px">

<input type="submit" value="Search" class="button" style="width:60px">

</form>


{if isset($_searcharea) && isset($_searchstring)}
 <table width="100%" cellpadding="0" cellspacing="0" border="0" align="center">
  {jr_ranking mode="artist" pagebreak="9" pagenum=$p footer_template="advanced_search_footer.tpl" search_area=$_searcharea search_string=$_searchstring}
 </table>
{/if}


Then you'll need to create an advanced_search_footer.tpl file with this:

advanced_search_footer.tpl:


Code

{* see if we have displayed any results - if not show message *}
{if $RANK_COUNT == 0}
<tr>
  <td width="100%" colspan="4">
    <h2>{jr_lang id="25" default="there are no results to show"}</h2>
  </td>
</tr>
{/if}

{* don't even show our footer if we only have 1 page *}
{if $TOTAL_PAGES > 1}

<tr>
  <td width="100%" colspan="10">
    <table width="100%" cellpadding="0" cellspacing="0">
      <tr>
        <td width="40%" style="text-align:right">
          {if $PAGENUM > 1}
            <a href="{$jamroom_index}?t=advanced_search{$SEARCH_AREA_URL}{$SEARCH_STRING_URL}&amp;p={$PREV_PAGE_NUM}">{jr_lang id="26" default="previous"}</a>
          {/if}
        </td>
        <td width="20%" style="text-align:center">

          {* decide if we are going to create a page jumper *}
          {if $TOTAL_PAGES <= 2}
            {$THIS_PAGE}&nbsp;/&nbsp;{$TOTAL_PAGES}
          {else}
            <form name="form" method="post" action="_self">
            <select name="pagenum" style="width:50px" onchange="var sel=this.form.pagenum.options[this.form.pagenum.selectedIndex].value;window.location='{$jamroom_index}?t=advanced_search{$SEARCH_AREA_URL}{$SEARCH_STRING_URL}&amp;p=' +sel;">
            {foreach from=$_PAGES key=page item=_pg}
              {if $page == $THIS_PAGE}
                <option selected value="{$page}"> {$page}</option>
              {else}
                <option value="{$page}"> {$page}</option>
              {/if}
            {/foreach}
            </select>&nbsp;/&nbsp;{$TOTAL_PAGES}</form>
         {/if}

        </td>
        <td width="40%">
          {if $NEXT_PAGE_NUM > 1}
            <a href="{$jamroom_index}?t=advanced_search{$SEARCH_AREA_URL}{$SEARCH_STRING_URL}&amp;p={$NEXT_PAGE_NUM}">{jr_lang id="27" default="next"}</a>
          {/if}
        </td>
      </tr>
    </table>
  </td>
</tr>

{/if}


Notes: You can use a custom header and row file if you like, or just use the jr_ranking_row.tpl file as shown here by not adding a header or row template to the jr_ranking call. Also, the jr_lang id's in the footer file may or may not line up with your language id's, so you'll want to make sure those are correct.

Thats about it. This will show the results on the same page as the search form so you'll need to create your page accordingly.

See it in action here.

Hope this helps Smile


_________________
Douglas Hackney
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
smith.kyle
CodeSmith


Joined: 27 Apr 2006
Posts: 22009
Location: Southern California

Posted: 06/10/08 12:43 
Nice dude! Very Happy


_________________
kyle[at]jamroom.net

Yes...that's a soda machine...

I get bored when no one's posting...
Back to top
Douglas
Jamroom Team


Joined: 08 Oct 2004
Posts: 6639
Location: Tornado Alley!

Posted: 06/10/08 12:44 
Thanks Kyle, had a lot of help from bigguy on this one. Wink


_________________
Douglas Hackney
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 06/10/08 12:56 
You are a Star SixString!!! And Bigguy too!!!

Thankyou very very much!


_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
Douglas
Jamroom Team


Joined: 08 Oct 2004
Posts: 6639
Location: Tornado Alley!

Posted: 06/10/08 13:15 
Your welcome Steve... just wish there was more time in a day, I would have had this up sooner. Wink


_________________
Douglas Hackney
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
bodawg



Joined: 27 Mar 2007
Posts: 1091
Location: On my knees begging DJ for help...again

Posted: 06/12/08 17:51 
So we can use this with custom search areas as well? I.e- band_????

Thanks for any info, and thanks for all of the time & effort you and BigGuy put into this... this is huge and really cool!!!

Great job Six Wink

-Rob


_________________
Got Kyle? "When a comfortable computer chair just isn't enough to save your a**"
Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 06/12/08 17:52 
Yes, this works with custom fields as well - I have been playing with this today and it is very cool! Very Happy


_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
Douglas
Jamroom Team


Joined: 08 Oct 2004
Posts: 6639
Location: Tornado Alley!

Posted: 06/12/08 17:53 

bodawg:
So we can use this with custom search areas as well? I.e- band_????

Thanks for any info, and thanks for all of the time & effort you and BigGuy put into this... this is huge and really cool!!!

Great job Six Wink

-Rob


Yes, it will work with custom form fields.

Thanks! Smile


_________________
Douglas Hackney
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
bodawg



Joined: 27 Mar 2007
Posts: 1091
Location: On my knees begging DJ for help...again

Posted: 06/12/08 17:54 
Awesome guys!!!

-Rob


_________________
Got Kyle? "When a comfortable computer chair just isn't enough to save your a**"
Back to top
pauolo



Joined: 07 Mar 2007
Posts: 801

Posted: 06/13/08 02:18 
GOOD!

Thanx

Back to top
pauolo



Joined: 07 Mar 2007
Posts: 801

Posted: 06/20/08 04:40 
Is there a way, to search the genre exactly by name?

If i search for only "Rock" it will result Rock, Rock - Ballad!

Back to top
Douglas
Jamroom Team


Joined: 08 Oct 2004
Posts: 6639
Location: Tornado Alley!

Posted: 06/20/08 05:59 

pauolo:
Is there a way, to search the genre exactly by name?

If i search for only "Rock" it will result Rock, Rock - Ballad!


Not that I'm aware of, you would probably want to use a different type of search to show a list of certain genres.

Hope this helps Smile


_________________
Douglas Hackney
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 06/20/08 08:48 
You can use strict_search="both" in your ranking function, then it will only find exact matches.

So I think you could do

Code
search_area="band_soundlike" search_string="Rock" strict_search="both"

It will only find Rock.

strict_search is the last one in the Common Function Parameters table here:
http://www.jamroom.net/Jamroom3_Ranking_System


_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
bodawg



Joined: 27 Mar 2007
Posts: 1091
Location: On my knees begging DJ for help...again

Posted: 02/26/09 17:02 
Hello,

I'm just curious as to how I would set this up so the results display on the same page?

I'm pretty sure I've followed this properly and have tried a combination of different ways to get the footer to display the search results properly inside the page and have also tried to get the results to display in a different template outside of the page and have spent some where around 10 straight hours trying to get this to work but to no avail?

The form shows up fine, the results seem to return properly but they end up displaying in (http://mysite.com/index.php) which just shows the form again and the results with no formatting or anything... how can I make them display with in the original page, what might I be missing?

Thanks for any help!

-Rob


_________________
Got Kyle? "When a comfortable computer chair just isn't enough to save your a**"
Back to top
whodaniel



Joined: 26 Jun 2006
Posts: 627

Posted: 02/26/09 20:11 
Any working examples to see?

Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
User Documentation and How To's

12Next >
 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.