Page 1 of 1

Linking to a file uploaded from CGBlog summary page [SOLVED]

Posted: Thu Jul 05, 2012 12:52 pm
by sam_m
Hello,

Im using CMSMS 1.10.3 and CGBlog 1.9.8

I wonder if anyone can advise, im trying to get the blog setup so when a file has been uploaded (pdf for example) a link to this is shown on the summary template within CGBlog, but I can`t figure out the correct code which needs to be entered within the summary template to allow a direct link to the uploaded file.

At the moment im working around with this code...

{if !empty($entry->fieldsbyname.upload->value)}
<a href="{$entry->file_location}">Click here to view file</a>{/if}


But it only links to the directory and not the file directly

Any help would be greatly appreciated

Thanks very much
Kind Regards
Sam

Re: Linking to a file uploaded from CGBlog summary page

Posted: Thu Jul 05, 2012 12:55 pm
by uniqu3
{$entry->file_location} is only path to loaction of file as you figured out so you need to add value of your extra field as weel.
{$entry->file_location}/{$entry->fieldsbyname.upload->value}

Re: Linking to a file uploaded from CGBlog summary page

Posted: Thu Jul 05, 2012 12:59 pm
by sam_m
uniqu3 wrote:{$entry->file_location} is only path to loaction of file as you figured out so you need to add value of your extra field as weel.
{$entry->file_location}/{$entry->fieldsbyname.upload->value}
Amazing!!! such a quick reply, thank you for much for your help, thats spot on :)

Kind Regards
Sam