Fátima Chapri
|
Tuesday 17 February 2009 1:04:50 pm
Hi, Here is my code of extension/ezwebin/design/ezwebin/templates/content/search.tpl
{let search=false()}
{section show=$use_template_search}
{set page_limit=10}
{set search=fetch(content,search,
hash(text,$search_text,
section_id,$search_section_id,
subtree_array,$search_subtree_array,
sort_by,array('modified',false()),
offset,$view_parameters.offset,
limit,$page_limit))}
{set search_result=$search['SearchResult']}
{set search_count=$search['SearchCount']}
{set stop_word_array=$search['StopWordArray']}
{set search_data=$search}
{/section}
<div class="content-search">
<form action={"/content/search/"|ezurl} method="get">
<div class="attribute-header">
<h1 class="long">{"Search"|i18n("design/ezwebin/content/search")}</h1>
</div>
<p>
<input class="halfbox" type="text" size="20" name="SearchText" id="Search" value="{$search_text|wash}" />
<input class="button" name="SearchButton" type="submit" value="{'Search'|i18n('design/ezwebin/content/search')}" />
</p>
{let adv_url=concat('/content/advancedsearch/',$search_text|count_chars()|gt(0)|choose('',concat('?SearchText=',$search_text|urlencode)))|ezurl}
<label>{"For more options try the %1Advanced search%2"|i18n("design/ezwebin/content/search","The parameters are link start and end tags.",array(concat("<a href=",$adv_url,">"),"</a>"))}</label>
{/let}
{section show=$stop_word_array}
<p>
{"The following words were excluded from the search:"|i18n("design/ezwebin/content/search")}:
{section name=StopWord loop=$stop_word_array}
{$StopWord:item.word|wash}
{delimiter}, {/delimiter}
{/section}
</p>
{/section}
{switch name=Sw match=$search_count}
{case match=0}
<div class="warning">
<h2>{'No results were found when searching for "%1".'|i18n("design/ezwebin/content/search",,array($search_text|wash))}</h2>
</div>
<p>{'Search tips'|i18n('design/ezwebin/content/search')}</p>
<ul>
<li>{'Check spelling of keywords.'|i18n('design/ezwebin/content/search')}</li>
<li>{'Try changing some keywords (eg, "car" instead of "cars").'|i18n('design/ezwebin/content/search')}</li>
<li>{'Try searching with less specific keywords.'|i18n('design/ezwebin/content/search')}</li>
<li>{'Reduce number of keywords to get more results.'|i18n('design/ezwebin/content/search')}</li>
</ul>
{/case}
{case}
<div class="feedback">
<h2>{'Search for "%1" returned %2 matches'|i18n("design/ezwebin/content/search",,array($search_text|wash,$search_count))}</h2>
</div>
{/case}
{/switch}
{section name=SearchResult loop=$search_result show=$search_result sequence=array(bglight,bgdark)}
{node_view_gui view=line sequence=$:sequence use_url_translation=$use_url_translation content_node=$:item}
{/section}
{include name=Navigator
uri='design:navigator/google.tpl'
page_uri='/content/search'
page_uri_suffix=concat('?SearchText=',$search_text|urlencode,$search_timestamp|gt(0)|choose('',concat('&SearchTimestamp=',$search_timestamp)))
item_count=$search_count
view_parameters=$view_parameters
item_limit=$page_limit}
</form>
</div>
{/let}
Whenever I try to make a search of any word or phrase that I'm sore it exists on my site content it keeps showing the following message: No results were found when searching for "". It seams that the Input Search Text is not getting the parameters correctly. But In the administration interface everything works fine. That's why I think that the ezserchengine.php file has nothing wrong with the code.
Any sugestion? Please Help!
|
justin kazadi
|
Tuesday 17 February 2009 11:44:09 pm
hi, i don't talk about the search.tpl but about your search form (in your pagelayout.tpl). i think you have an error on your form.
No results were found when searching for "".
means that the search engine don't get correctly the SearchText. so the searchtext is empty. use this code:
<form id='search_from' action={"/content/search"|ezurl} >
<label for="searchtext">rechercher sur le site</label>
<input id="searchtext" name="SearchText" type="text" />
<input id="searchbutton" type="submit" value="OK"/>
</form>
The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.
Albert Einstein
|
Fátima Chapri
|
Wednesday 18 February 2009 12:13:34 am
Hi Justin,
I tried using your code. Mine was same as your's but with a small difference: mine had if statements. Even though i used your and cleaned the cache to see the modifications. Made a 1st search after that and everything was fine. But when i made a 2nd search with diferent paramenters it showed me the results of the previous search. I tried cleaning the cache and do the search again, and voilá, everything fine again. This manda me realise that there's nothing wrong with the code. But that the promlem is the the cache statements. I'l have to investigaue the cache statements of the page5azout.tpl to find out what's wrong
|