Forums / Setup & design / Serchresult.tpl

Serchresult.tpl

Author Message

kavi kavi

Monday 30 October 2006 2:55:06 am

Hi
In my serch result i don't want to display the class name.
Any on have a suggestion ? I want only to display the result with link.

Claudia Kosny

Wednesday 01 November 2006 9:11:40 am

Hi Kavi

Enable the debug output to display the list of used templates. Then you can see which template is used to display the search result. Then just create an override for this template which does not display the classname.

If you any specific problems with that, just ask. In this case also tell which version of EZ you use.

Greetings from Luxembourg

Claudia

kavi kavi

Thursday 02 November 2006 12:56:54 am

Hi Claudia !

Thank u for your reply. I know how to overide a template file but my problem is the language in the template.

There is my code in my template :

{let use_url_translation=ezini('URLTranslator','Translation')|eq('enabled')}

{section show=$search_result}
<table class="list" width="100%" border="0" cellspacing="0" cellpadding="0">
<!--<tr>
<th>{"Name"|i18n("design/standard/content/search")}</th>
<th width="1">{"Class"|i18n("design/standard/content/search")}</th>
</tr>-->
<tr>

{section name=SearchResult loop=$search_result show=$search_result sequence=array(bglight,bgdark)}

{node_view_gui view=search sequence=$:sequence use_url_translation=$use_url_translation content_node=$:item}

{delimiter modulo=1}
</tr>
<tr>
{/delimiter}
{section-else}
{/section}
</tr>
</table>
{/section}
{/let}

This displays the search result and and the class (like this for example)

result classes
Vidéo test Windows media
test Article Article

I don't want to dispay the class name. I want only result with links

Mark Marsiglio

Thursday 02 November 2006 3:58:18 am

The template code that you reference here generates the table that displays the search results. You might want to remove only this part from the template:

<th width="1">{"Class"|i18n("design/standard/content/search")}</th>

Then, there is another template that controls the line view display of the individual search results.

Override templates/node/view/search.tpl which looks like this:


{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{default use_url_translation=false()}
    <td class="{$sequence}">
    <a href={$node.url_alias|ezurl}>{$node.name|wash}</a>
       
    </td>
    <td class="{$sequence}">
      <nobr>{$node.object.class_name|wash}</nobr>
    </td>
{/default}

And remove this part:

    <td class="{$sequence}">
      <nobr>{$node.object.class_name|wash}</nobr>
    </td>

If you don't remove the 2nd column from the table in the other template it will look a little weird, so make sure that the header only has the 1 col too.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

kavi kavi

Thursday 02 November 2006 8:45:58 am

Thanks for your help Mark
I've never guess that it's in node/view/search.tpl, the override has to be done..

Claudia Kosny

Thursday 02 November 2006 9:27:36 am

Hi Kavi

Here just a short explanation:
In the search result template you had the line

{node_view_gui view=search sequence=$:sequence use_url_translation=$use_url_translation content_node=$:item}

This line calls up the node_view_gui function with the given parameters for each of the nodes in the search result. One of the parameters is the parameter 'view' and this tells the function which template to use. The template must be in the folder templates/node/view/ and have the same name as the value given in the parameter 'view'.

So if you specify {node_view_gui view=search ... then the template templates/node/view/search.tpl is used. If you would have specified {node_view_gui view=foo... ez would have looked for a template templates/node/view/foo.tpl to display the node.

More info here:
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/visualization/node_view_gui

Greetings from Luxembourg

Claudia