Forums / Setup & design / Nice related object URI

Nice related object URI

Author Message

Pascal France

Thursday 13 December 2007 9:48:43 am

Hi,

I use the Related object frame of the Edit interface to link objects (PDF files) to articles.
The code I use to create the link to these PDF files is:

{if $node.object.related_contentobject_array}
   <ul>
      {while lt($i, $node.object.related_contentobject_count)}
         {if $node.object.related_contentobject_array.$i.data_map.file}
            {set $mime=$node.object.related_contentobject_array.$i.data_map.file.content.mime_type}
            {set $filepath=$node.object.related_contentobject_array.$i.data_map.file.content.filepath}
            {set $size=$node.object.related_contentobject_array.$i.data_map.file.content.filesize}
             <li>
                <a href={$filepath|ezroot} title="Téléchargez le document au format {$mime}">{$mime|mimetype_icon( 'normal')}</a><br />
                {$node.object.related_contentobject_array.$i.data_map.name.content}<br />
                 ({$size|si( byte, binary )})
              </li>
         {else}{* POUR ETRE W3C COMPLIANTE *}
            <li>
            </li>
         {/if}
     {set $i=inc($i)}
     {/while}
   </ul>
{/if}

This works well but the link produced looks like:

http://www.linuxorable.fr/cfdt/var/cfdt/storage/original/application/1901539c9a4d14f3a9bf17a37081cb75

The name of the PDF file is MyFile.pdf and I would prefere a link which would look like that:

http://www.linuxorable.fr/cfdt/path/to/the/file/MyFile.pdf

Is there a way to achieve such a thing ?

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish