CGUserDirectory's search - how to display "no results"?
Posted: Fri Jul 05, 2013 3:39 pm
If CGUserDirectory's search don't find anything the page is empty. How can I display "Zero results" or something similar?
Content management as it is meant to be
https://forum.cmsmadesimple.org/
I made one own but also tested the sample template. Same result.Rolf wrote:What is the content of the search template you use?
Code: Select all
{* search form template *}
{* valid fields are:
{$actionid}ud_submit - (string) for a submit button
{$actionid}ud_cancel - (string) for a cancel button
{$actionid}ud_username - (string) username expression
{$actionid}ud_propvalue - (string) property value
*}
<div id="ud_searchform">
{$formstart}
{if isset($searchprops)}
{foreach from=$searchprops key='propname' item='data'}
<div class="row">
<div class="col30">{$data.fielddefn.prompt}:</div>
<div class="col70">
{if $data.fieldtype == 'text'}
<input type="text" name="{$actionid}ud_propvalue[{$propname}]" size="20" maxlength="100"/>
{else if $data.fieldtype == 'select'}
<select name="{$actionid}ud_propvalue[{$propname}]">
{html_options options=$data.options}
</select>
{/if}
</div>
</div>
{/foreach}
{/if}
{*
<div class="row">
<p class="col30">{$mod->Lang('results_all_any')}?</p>
<p class="col70">
<select name="{$actionid}ud_allany">
<option value="all">{$mod->Lang('all')}</option>
<option value="any">{$mod->Lang('any')}</option>
</select>
</p>
</div>
*}
<div class="row">
<p class="col30"> </p>
<p class="col70">
<input type="submit" name="{$actionid}ud_submit" value="{$mod->Lang('submit')}"/>
</p>
</div>
{$formend}
</div>
Code: Select all
{if !$users}<p>No users found</p>{/if}
Yes, the results are shown using summary template, but if search didn't find anything, the summary table isn't used. So unfortunately this didn't work.Rolf wrote:Looks like this module doesn't have a seperate Search Results template you can change...
The result are probably show with a summary template. Put in the top of the template something like:Might do the trickCode: Select all
{if !$users}<p>No users found</p>{/if}
Code: Select all
{content assign='custom_content'}
{if !empty($custom_content)}
{$custom_content}
{else}
<p>No results</p>
<p><a href="#" onclick="window.history.back();return false;">Go back</a></p>
{$custom_content}
{/if}