Hi,
I'm using search module 1.7 and would like to exclude all contant aliases from search result.
[SOLVED] Excluding Contant aliasis from search result
[SOLVED] Excluding Contant aliasis from search result
Last edited by gmb on Sun Mar 11, 2012 2:20 pm, edited 1 time in total.
Re: Excluding Contant aliasis from search result
You can modify your search results template to exclude anything you want.
Re: Excluding Contant aliasis from search result
Thanks for replying,
I've been trying to do just that. I used the default searchresult template with minor adjustment, but can't get it right.
here are some other if statements I've also tried to use, but nothing seems to work. I don't know how to reach content alias type.
{if Content-type != content aliases}
{if $entry->module != 'ContentAliases'}
{if $entry->Content-type != 'ContentAliases'}
{if ($content_obj->mType != 'ContentAliases')}
Please tell me how, i'm stuck bigtime.
I've been trying to do just that. I used the default searchresult template with minor adjustment, but can't get it right.
Code: Select all
{debug}
<h3>{$searchresultsfor} "{$phrase}"</h3>
{if $itemcount > 0}
<pre> {$entry|print_r}</pre>
<ul>
{foreach from=$results item=entry}
{if !{$page_alias}} {* this is the part I've added*}
<li>{$entry->title} - <a href="{$entry->url}">{$entry->urltxt}</a> ({$entry->weight}%) </li>
{*
You can also instantiate custom behaviour on a module by module basis by looking at the $entry->module and $entry->modulerecord fields in $entry ie: {if $entry->module == 'News'}{News action='detail' article_id=$entry->modulerecord detailpage='News'}
*}
{/if}
{/foreach}
</ul>
<p>{$timetaken}: {$timetook}</p>
{else}
<p><strong>{$noresultsfound}</strong></p>
{/if}
{if Content-type != content aliases}
{if $entry->module != 'ContentAliases'}
{if $entry->Content-type != 'ContentAliases'}
{if ($content_obj->mType != 'ContentAliases')}
Please tell me how, i'm stuck bigtime.
Re: Excluding Contant aliasis from search result
Couple of issues:
{if !{$page_alias}} should have given you an error... Correct: {if !$page_alias}, but this isn't the problem.. $page_alias isn't set for each search result.. It will contain the value of the current page, and is always set.
Try: {if $entry->module} .. This is set only if the result is a module entry, like a news article, or calendar date item and is not set if it's a content page.
{if !{$page_alias}} should have given you an error... Correct: {if !$page_alias}, but this isn't the problem.. $page_alias isn't set for each search result.. It will contain the value of the current page, and is always set.
Try: {if $entry->module} .. This is set only if the result is a module entry, like a news article, or calendar date item and is not set if it's a content page.
Re: [SOLVED] Excluding Contant aliasis from search result
It works!
Thanks a lot!!!
Thanks a lot!!!