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

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

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

Post by urheat »

If CGUserDirectory's search don't find anything the page is empty. How can I display "Zero results" or something similar?
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

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

Post by Rolf »

What is the content of the search template you use?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

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

Post 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.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

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

Post by Rolf »

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
- + - + - + - + - + - + -
Image
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

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

Post 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>
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

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

Post 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
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

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

Post 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.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

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

Post by Rolf »

It worked for me, when I tested it...
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Audiosonic
New Member
New Member
Posts: 4
Joined: Wed Aug 21, 2013 3:24 pm

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

Post by Audiosonic »

I have the same problem! Just shows blank page when there are no results, have you found a solution?
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

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

Post 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.
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am
Location: Finland

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

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

Return to “Modules/Add-Ons”