How to make a seach template for files?

Author Message

Helle Andersen

Friday 13 August 2010 2:11:46 am

Our search templates mostly looks like this:

 {def $use_url_translation=false()}
            <strong><a href="{$node.global_url_alias}">{$node.name|wash}</a></strong>
       <div class="attribute-short">
            {$node.highlight}
        </div>

This of course does not work for files since their url is something like /content/download/110598/1433673/file/name.pdf.

If the object is a file (e.g. a pdf file), what is the code for getting the file (instead of

{$node.global_url_alias}

Jérôme Vieilledent

Saturday 14 August 2010 1:42:10 am

Hi Helle

Maybe you just need to override the result template and add something like this :

{def $use_url_translation=false()}

{if is_set( $node.data_map.file )}
    {attribute_view_gui attribute=$node.data_map.file}
{else}
    <strong><a href="{$node.global_url_alias}">{$node.name|wash}</a></strong> 
{/if}
<div class="attribute-short">{$node.highlight}</div>

Helle Andersen

Monday 16 August 2010 2:59:28 am

Thanks - works fine

Helle

Jérôme Vieilledent

Monday 16 August 2010 3:09:03 am

Great :)

Can you please flag this topic as resolved ?

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.