CGUserDirectory's search - how to display "no results"?
CGUserDirectory's search - how to display "no results"?
If CGUserDirectory's search don't find anything the page is empty. How can I display "Zero results" or something similar?
Re: CGUserDirectory's search - how to display "no results"?
What is the content of the search template you use?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: CGUserDirectory's search - how to display "no results"?
I made one own but also tested the sample template. Same result.Rolf wrote:What is the content of the search template you use?
If the search finds something, then the summary view template is used and I can add there some logic to count the hits. But if search doesn't find anything, summary view template isn't used. I don't know what happens. There is only title and the content is empty.
Re: CGUserDirectory's search - how to display "no results"?
I ask WHAT is the content of the template. Post it here, so we can see it 

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: CGUserDirectory's search - how to display "no results"?
Search template:
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>
Re: CGUserDirectory's search - how to display "no results"?
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 trick
The result are probably show with a summary template. Put in the top of the template something like:
Code: Select all
{if !$users}<p>No users found</p>{/if}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Re: CGUserDirectory's search - how to display "no results"?
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}
Re: CGUserDirectory's search - how to display "no results"?
It worked for me, when I tested it...
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
-
- New Member
- Posts: 4
- Joined: Wed Aug 21, 2013 3:24 pm
Re: CGUserDirectory's search - how to display "no results"?
I have the same problem! Just shows blank page when there are no results, have you found a solution?
Re: CGUserDirectory's search - how to display "no results"?
Don't know how Ronald managed to do that, 'cause I can't:
1. Installed fresh 1.11.9 and the latest FEU & CGUserDirectory
2. Made a few users
3. Added "{if !$users}<p>No users found</p>" to the top of summary template of CGUserDirectory.
4. Tried search, if search won't find anything, all I can see in the content section is the title of the page.
I'll report this as a bug to the forge.
1. Installed fresh 1.11.9 and the latest FEU & CGUserDirectory
2. Made a few users
3. Added "{if !$users}<p>No users found</p>" to the top of summary template of CGUserDirectory.
4. Tried search, if search won't find anything, all I can see in the content section is the title of the page.
I'll report this as a bug to the forge.
Re: CGUserDirectory's search - how to display "no results"?
The issue still exists, but with following workaround you can display something to the user:
From the page template:
Hopefully this helps if you have encountered the same problem
From the page template:
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}
Hopefully this helps if you have encountered the same problem
