Forums / Setup & design / How to avoid "No results were found when searching for..."?

How to avoid "No results were found when searching for..."?

Author Message

Martin Crockett

Thursday 03 February 2005 8:51:01 am

The default search page displays the above message when visited.

It's a little confusing to first-time visitors.

How can I tweak the settings in the .tpl file to make it NOT display this message when the search page first loads?

Any help is gladly appreciated.

Eivind Marienborg

Thursday 03 February 2005 9:57:14 am

I would try mocking around with the searchresult-template. To override it, use this:

[searchresult]
Source=content/searchresult.tpl
MatchFile=searchresult.tpl
Subdir=templates

And of course create the correct template in your template dir..

Martin Crockett

Friday 04 February 2005 2:18:04 am

Unfortunately, the template is already being overwritten...

I need to stop the no results found message appearing on page load - when the user hasn't actually searched for anything yet.

If I don't get a decent reply, I'll add this to the list of unfathomable eZ Publish problems. ;-)

Roy Bøhmer

Sunday 06 February 2005 4:15:19 am

I've done a section show= to test if the user did write search-text or just clicked the button and used the default search-texkt "search text".

{section show=not(or(eq(0, $search_text|trim|count_chars), eq($search_text, 'search text')))}

Then you make a section-else to provide a deasent presentation if no words where provided by the user.

Andre Felipe Machado

Thursday 24 February 2005 3:42:10 pm

Hello,
Actually, it is already done on template search.tpl
You should create a template or override (according to your design) and include only the FIRST PART of 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}

<form action={"/content/search/"|ezurl} method="get">

<div class="maincontentheader">
<h1>{"Search"|i18n("design/standard/content/search")}</h1>
</div>

<div class="block">
    <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/standard/content/search')}" />
</div>

<div class="block">
    {let adv_url=concat('/content/advancedsearch/',$search_text|count|gt(0)|choose('',concat('?SearchText=',$search_text|urlencode)))|ezurl}
    <label>{"For more options try the %1Advanced search%2"|i18n("design/standard/content/search","The parameters are link start and end tags.",array(concat("<a href=",$adv_url,">"),"</a>"))}</label>
    {/let}
</div>


</form>
{/let}

It works. I use it at my site.
Good luck.
Andre Felipe

---
A Debian user never dies. Issues a last command:
shutdown -h now

http://www.techforce.com.br

eZ debug

Timing: Jan 31 2025 01:16:14
Script start
Timing: Jan 31 2025 01:16:14
Module start 'content'
Timing: Jan 31 2025 01:16:14
Module end 'content'
Timing: Jan 31 2025 01:16:15
Script end

Main resources:

Total runtime0.2024 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 588.1719370.2734
Module start 'content' 0.00700.0198 958.44531,005.7500
Module end 'content' 0.02680.1755 1,964.19533,893.7422
Script end 0.2023  5,857.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00492.4406200.0002
Check MTime0.00160.7845200.0001
Mysql Total
Database connection0.00080.398310.0008
Mysqli_queries0.094646.76171410.0007
Looping result0.00140.69751390.0000
Template Total0.175186.510.1751
Template load0.00100.486710.0010
Template processing0.174186.014710.1741
Override
Cache load0.00070.332010.0007
Sytem overhead
Fetch class attribute can translate value0.00190.924010.0019
XML
Image XML parsing0.00030.139810.0003
General
dbfile0.00934.5806200.0005
String conversion0.00000.002930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0003 secs