rendered paste bodyThis is the PHP code for the new search.php using Smarty
===============================================================
<?php
/**
* @package WWSR
* @file search.php
*
* Search Results page launcher
*
* $Id: search.php 2006-06-04 13:00:00 rajib $
* */
require_once("config.inc.php"); // config
require_once(INCLUDES_DIR . 'WWSR_Search.class.php'); // Search class
$smarty = new WWSR_Smarty;
$smarty->wwsr_register_css('wwsrSearch.css');
$smarty->wwsr_set_section_title('Search');
$smarty->wwsr_set_page_title('Search WWSR');
$smarty->wwsr_register_facet('search_wwsr.tpl');
$smarty->display('searchPage');
if(isset($_REQUEST['searchSelection']) )
{
$smarty->wwsr_register_facet('search.tpl');
switch($_REQUEST['searchSelection'])
{
case "people":
$searchString = $_GET['searchQuery'];
$searchPeople = new WWSR_Search(WWSR_DB_DB,WWSR_DB_US,WWSR_DB_PA,"$searchString","people",WWSR_DB_HOST);
// Validate the search string, if nothing is entered, show a message and exit.
$resultSet = array();
$resultSet = $searchPeople->validateSearch();
if( count($resultSet) > 0 )
{
$smarty->assign('searchClass', 'noRecord' );
$smarty->assign('searchResult', '$resultSet');
break;
}
// User has entered a search string, perform the search.
$resultSet = array();
$searchPeople->doBasicSearch('long','0','10');
$resultSet = $searchPeople->getResult();
if(count($resultSet) == 0 )
....
....
This is the code of the template search.tpl (residing in templates directory)
================================================================================
<%* main WWSR frame template
$Id: search.tpl 130 2006-06-02 22:09:16Z rajib $
*%>
<% if $searchClass eq "noRecord" %>
<br /> <br /> <br /> <br />
<p><b><i>Too many results returned, please enter keywords to narrow down your search</i></b></p>
<%/if%>
<% if $searchClass eq "people" %>
<h4><b><span class="style4">Search Results for "<%$searchstring%>" | Search executed in <%$timetaken%> seconds</span></b></h4>
<h1><span class="style1"><span class="style3"><span class="style4">People Search</span> </span><a href="displayUser.php?req=process&userid">Find more >>></a> </span></h1>
<br /><br />
<% if $numRecs > 0 %>
<%foreach from=$searchresult item=searchResult %>
<a href="displayUserBio.php?user_id=<% $searchResult.user_id %>>"<% $searchResult.firstname:captialize %><% $searchResult.middlename:captitalize %><% $searchResult.lastname:capitalize %></a><br />
<%/foreach>
<%else%>
<br /><br /><br />
<p><b><i>No results found for <% searchString %></i></b></p>
<br /><br /><br />
<%/if%>
<%if $searchClass eq "organizations" %>
<h4><b><span class="style4">Search Results for "<%$searchstring%>" | Search executed in <%$timetaken%> seconds</span></b></h4>
<h1><span class="style1"><span class="style3"><span class="style4">Organization Search</span> </span><a href="displayUser.php?req=process&userid">Find more >>></a> </span></h1>
<br /><br />
<%if $numRecs > 0 %>
<%foreach from=$searchresult item=searchResult %>
<a href="displayOrgBio.php?org_id=<% $searchResult.org_id %>>"<% $searchResult.org_name:captialize %> (<% $searchResult.org_acronym:captitalize %>)</a><br />
<%/foreach>
<%else%>
<br /><br /><br />
<p><b><i>No results found for <% searchString %></i></b></p>
<br /><br /><br />
</%if%>
<%if $searchClass eq "events" %>
<h4><b><span class="style4">Search Results for "<%$searchstring%>" | Search executed in <%$timetaken%> seconds</span></b></h4>
<h1><span class="style1"><span class="style3"><span class="style4">Events Search</span> </span><a href="displayUser.php?req=process&userid">Find more >>></a> </span></h1>
<br /><br />
....
....
This is the error message I'm getting (when I set $debug = true in WWSR_Smarty.class.php)
============================================================================================
Warning: Smarty error: unable to read resource: "searchPage" in /var/www/html/rsarkar/wwsr/include/Smarty/Smarty.class.php on line 1095
Notice: Undefined index: wwsr_css_files in /var/www/html/rsarkar/wwsr/templates_c/%%72^72D^72DAF6E8%%main.tpl.php on line 12
Notice: Undefined index: wwsr_js_libs in /var/www/html/rsarkar/wwsr/templates_c/%%72^72D^72DAF6E8%%main.tpl.php on line 17
Notice: Undefined index: wwsr_menu_facets in /var/www/html/rsarkar/wwsr/templates_c/%%72^72D^72DAF6E8%%main.tpl.php on line 42
Search WWSR
Notice: Undefined index: wwsr_facets in /var/www/html/rsarkar/wwsr/templates_c/%%72^72D^72DAF6E8%%main.tpl.php on line 83
© Copyright 2006 WWSR