CGUserDirectory empty results page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
tristan
Dev Team Member
Dev Team Member
Posts: 375
Joined: Tue May 02, 2006 10:58 am

CGUserDirectory empty results page

Post by tristan »

Hi there,

Still having the exact same problem as described in this locked topic:

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

and posted in this closed bug report:

If search won't find anything the content is empty

With CGUserDirectory 1.4.5 and CMS Made Simple 1.11.11 I use the following tag to output a form to search for users:

Code: Select all

{CGUserDirectory action='search' resultpage='search-a-blogger' summarytemplate='SearchList'}
and this is my (default) search form template:

Code: Select all

<__script__ type="text/javascript">
function emptyField() {
    var field = document.getElementById("{$actionid}ud_username").value;
    return (field == '') ? false : true;
}
</__script>
<form id="{$actionid}moduleform_1" method="post" action="{root_url}/blog/search-a-blogger" class="cms_form" enctype="multipart/form-data" onSubmit="return emptyField();">
    <div class="hidden">
        <input type="hidden" name="mact" value="CGUserDirectory,{$actionid},do_search,0" />
        <input type="hidden" name="m{$actionid}returnid" value="74" />
        <input type="hidden" name="{$actionid}summarytemplate" value="SearchList" />
    </div>
    <input type="text" name="{$actionid}ud_username" id="{$actionid}ud_username" class="text" />
    <input type="hidden" name="{$actionid}ud_allany" value="any" />
    <input type="submit" name="{$actionid}ud_submit" class="submit" value="> Zoek" />
</form>
When nothing is found the summary view template isn't processed/displayed at all and the content part from the result page isn't displayed either. If this isn't a bug, can we have a feature to somehow display something when nothing is found?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: CGUserDirectory empty results page

Post by velden »

Code: Select all

{CGUserDirectory action='search' inline=1 assign='searchresult'}
{if !empty($searchresult)}{$searchresult}{else}No results{/if}
tristan
Dev Team Member
Dev Team Member
Posts: 375
Joined: Tue May 02, 2006 10:58 am

Re: CGUserDirectory empty results page

Post by tristan »

Thanks velden, there are also some workarounds in the other thread, in the end we worked around this by adding this to the resulting page template:

Code: Select all

{if $page_alias == 'search-a-blogger' ' && empty($main_content)}
    <h1>Search a blogger</h1>
    <p>No results</p>
{else}
    {$main_content}
{/if}
However I still think it would be more logical to handle this in the module itself, for example in the summary view template.
Post Reply

Return to “Modules/Add-Ons”