Page 1 of 1

CGUserDirectory's search - how to display "no results"?

Posted: Fri Jul 05, 2013 3:39 pm
by urheat
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"?

Posted: Fri Jul 05, 2013 4:44 pm
by Rolf
What is the content of the search template you use?

Re: CGUserDirectory's search - how to display "no results"?

Posted: Fri Jul 05, 2013 7:03 pm
by urheat
Rolf wrote:What is the content of the search template you use?
I made one own but also tested the sample template. Same result.

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"?

Posted: Fri Jul 05, 2013 7:16 pm
by Rolf
I ask WHAT is the content of the template. Post it here, so we can see it ;)

Re: CGUserDirectory's search - how to display "no results"?

Posted: Fri Jul 05, 2013 7:43 pm
by urheat
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"?

Posted: Sun Jul 07, 2013 2:11 pm
by Rolf
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:

Code: Select all

{if !$users}<p>No users found</p>{/if}
Might do the trick

Re: CGUserDirectory's search - how to display "no results"?

Posted: Mon Jul 08, 2013 7:13 pm
by urheat
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:

Code: Select all

{if !$users}<p>No users found</p>{/if}
Might do the trick
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.

Re: CGUserDirectory's search - how to display "no results"?

Posted: Mon Jul 08, 2013 7:31 pm
by Rolf
It worked for me, when I tested it...

Re: CGUserDirectory's search - how to display "no results"?

Posted: Fri Oct 11, 2013 7:43 am
by Audiosonic
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"?

Posted: Sun Oct 27, 2013 5:23 am
by urheat
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.

Re: CGUserDirectory's search - how to display "no results"?

Posted: Fri Nov 21, 2014 6:29 pm
by urheat
The issue still exists, but with following workaround you can display something to the user:

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 :)