Forums / General / Click and display

Click and display

Author Message

Franck T.

Friday 18 August 2006 7:50:21 am

Hello everybody,
When fetching related objetcs, I get one or several links. This is the corresponding code:

{def $objects=fetch( 'content', 'related_objects',
                    hash( 'object_id', $node.object.id,'all_relations', true()) )}
       {foreach $objects as $object}
           <a href={$object.main_node.url_alias|ezurl}>{$object.name|wash()}</a>
       {/foreach}

In my site, related objects are mainly PDF or Microsoft Word documents.
My question is: is it possible, on clicking one link, to immediatly open the document without first browsing into ezpublish Media (or Files) folder ?
Thanks for all idea.

Nate Parsons

Wednesday 27 September 2006 1:12:08 pm

Yo Frank,

Try using something like this for your link instead of the url_alias:


{attribute_view_gui attribute=$content_object.data_map.all_resource_file}

(The above code assumes that you've added a "file" attribute to the class object that you're viewing...)

---------------------------------------------------------------------------------
I look forward to an America which will not be afraid
of grace and beauty.

-------------JFK 10/26/63------------------------------------------------