Jump to content
TNG Community
tngrlkrz

Template 11 Mod: Include ID in Homepage Search

Recommended Posts

tngrlkrz

This has also been posted on the tngusers2 list.

Would like to modify the ‘search’ (see below) on template11 index.php to include the Person ID, in addition to the First Name, Last Name located just above the ‘search’ click button.  Below that are the normal menu items.  This would be similar to the fields in the dropdown ‘quick search’ activated by admin:setup which contains 3 fields, first name,last name, and ID.  It is not a ‘equal, contains, starts with’ field, just the ID match.    Did copy some code from searchform.php, but haven’t been able to effectively remove the array ‘equal,contains,starts with’ and just set with equal to the data entered for submission to the search. 

Entering directly on the Home page saves an extra click to get to another page besides the homepage to enter the ID.

Also using the Married Name in Search MOD as well, which is a really simplifies searching for women.

Alternatively, could use the index.php menu item  ‘advanced search’, converting it to a quick search, but the admin:setup doesn’t effect that, even though both call searchform.php.

Thanks in advance for any help.  Note: also using Chris Moss's Married Name Search mod as well at this time.

Ron

TNG 11.0.1   http://www.kmtrees.com wampserver 2.5,legacy 7.5,  family historian 6.2.2, win 10 pro

2016-06-17_12-31-26.jpg

Share this post


Link to post
Share on other sites
jayat1familytree

Ron,

I just quickly added the search box for PersonID to my "search" form and it does work,

however , as you mentioned, it still collects all instances ( equal, contains, starts with ) and not just equal.

Someone better at code should know where the changes would need to be made on the search.php file.

Here is the code I use to search from all pages

(this is on all pages including index, because its actually in the left navigation, which is the start of the 'footer.php" file on my site.)

<?php global $currentuserdesc,  $currentuser, $theme, $text ; ?>
// Start Search Form Global
<div>
          <form action="search.php" method="get">
<fieldset class="searchform">
<!-- <legend>SEARCH</legend>-->
    <dl>
    <dt><label for="mylastname" title="Enter the surname without any spaces">Last Name:<input id="mylastname" name="mylastname" type="text" /></label></dt>
    <dt><label for="myfirstname" title="Enter a first name or leave blank for all">First Name:<input id="myfirstname" name="myfirstname" type="text" /></label></dt>
    <dt><label for="myspname" title="Enter Maiden surname (Optional)">Spouse Name:<input id="myspname" name="myspname" type="text" /></label></dt>
    <dt><label for="mypersonid" title="Enter PersonID">Person ID:<input id="mypersonid" name="mypersonid" type="text" /></label></dt>
    <dt><input type="hidden" name="mybool" value="and" /><input type="submit" class="button" name="search" value="Search" /></dt>
    </dl>
</fieldset>
</form><!--end searchform-->
</div>

 

Hope that helps,

Jay

1Familytree.com

 

 

 

 

Share this post


Link to post
Share on other sites
tngrlkrz

Jay,

 

Will give it a look and a try.   The unmodified index.php for template 11 has the search menu on the upper right.  Jay, I noticed on your site the quick search in the inner menu (not the left menu) defaults to 'contains', whereas mine defaults to 'equals', which is what I would like.  Your left menu defaults to 'contains' as well.   Just interesting that your quick search (in the home, search, login ribbon) works differently.

Thanks!

Ron

TNG 11.0.1   http://www.kmtrees.com wampserver 2.5,legacy 7.5,  family historian 6.2.2, win 10 pro

 

 

Edited by tngrlkrz
more detail.

Share this post


Link to post
Share on other sites
tngrlkrz

Yes, I'm able, with that code, as I was in some testing with the code I mentioned earlier from searchform.php, to get the personal id on the homepage, but it defaults to 'contains' rather than 'equals'.  That is the key I'm missing yet.  I don't see how to get that into the data field internally before passing to the search routine.  I only know a little of php, I'm afraid. 

But thanks for the response.  

Ron

TNG 11.0.1   http://www.kmtrees.com wampserver 2.5,legacy 7.5,  family historian 6.2.2, win 10 pro

Share this post


Link to post
Share on other sites
tngrlkrz

With just a couple lines of added code to template11's index.php, I'm able to get the field for entry of the Person ID. But the qualifier (not entered) defaults to 'contains', I just need 'equals' instead and all would be good. 

                                   <td class="fieldnameback fieldname"><?php echo $text['personid'];?>:</td>
                                  <input type="text" name="mypersonid" value="<?php echo $mypersonid; ?>" />  

I also have the 'Married Name in Search' Mod active in this example as well.

 

right search.jpg

Ron

TNG 11.0.1   http://www.kmtrees.com wampserver 2.5,legacy 7.5,  family historian 6.2.2, win 10 pro

Share this post


Link to post
Share on other sites
tngrlkrz

Still looking for what code to add in index.php to force or default search.php to search for an entered person id as being 'equal' rather than 'contains' the entered digits.  This is code from index.php so far, creating result in the image below.

                                            <form method="get" name="searchform" action="search.php">


                                                  <label for="myfirstname"><?php echo $text['firstname']; ?></label>
                                                <input size="12" type="text" value="" name="myfirstname" />
                                                <br />
                                                  <label for="mylastname"><?php echo $text['lastname']; ?></label>
                                                <input size="12" type="text" value="" name="mylastname" />
                                           <br/>    <!-- Married Name in Search Mod -->
               <input type="radio" name="nametype" value="B" checked="checked"/><?php echo $text['birth'];?>
               <input type="radio" name="nametype" value="M"/><?php echo $text['married'];?> <br/>
                                                <input type="hidden" name="mybool" value="AND" />
                                                <input type="submit" id="search-submit" value="<?php echo $text['search']; ?>" />
                                    <br />
                                        <td class="fieldnameback fieldname"><?php echo $text['personid'];?>:</td>
                                  <input size="12"  type="text" name="mypersonid" value="<?php echo $mypersonid; ?>" /> 
                                        <option value="equals"><?php echo $text['equals']; ?></option>

                                         </form>

 

right search.jpg

Anybody know what code is needed to accomplish this? What is happening is whatever is entered, all persons having ID's containing these digits are displayed, rather than the one person having that precise ID.

Ron

TNG 11.0.1   http://www.kmtrees.com wampserver 2.5,legacy 7.5,  family historian 6.2.2, win 10 pro

Share this post


Link to post
Share on other sites
tngrlkrz

No responses so far, so for now getting results wanted  by adding one line to search.php (will add to a private Mod for misc items).

$_SESSION['tng_search_idqualify'] = $idqualify;
//force always to 'equals' for person ID
$idqualify = "equals";

$mypersonid = trim(stripslashes($mypersonid));
$_SESSION['tng_search_personid'] = cleanIt($mypersonid);

Until a better answer comes along, losing 'startwith,endwith and contains' only for person id not a big deal, since not a very meaningful search, IMO.

I had trouble presetting the variable in the search /form in index.php to 'equals'  before the sending to the action of search.php, so had to take the more drastic route of modifying search.php itself.

If anyone knows...please let me know.

Ron

TNG 11.0.1   http://www.kmtrees.com wampserver 2.5,legacy 7.5,  family historian 6.2.2, win 10 pro

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×