Page 1 of 1

Module news img url

Posted: Wed Feb 10, 2016 3:55 pm
by grazia
hello,

in module NEWS I added an img field
{$entry->fields['immagine']->value}

now I have to call this image with absolute URL to complete this
<meta property="og:image" content=" ">

What can I use? If I write www-mysite.com/uploads/news/{$entry->fields['immagine']->value}
I don't include subdirectories of news.

The address complete is www-mysite.com/uploads/news/16/71/imagename.jpg for example.
Have you already done this in some way?

Thanks

Re: Module news img url

Posted: Wed Feb 10, 2016 4:04 pm
by velden
From the sample detail template of the News module (CMSMS 2.1.1):
file_location (string) = A url containing the location where files attached the article are stored... the field value should be appended to this url.
Further down the template:

Code: Select all

<img src="{$entry->file_location}/{$field->value}"/>
Which in your case should be:

Code: Select all

{$entry->file_location}/{$entry->fields['immagine']->value}

Re: Module news img url

Posted: Wed Feb 10, 2016 4:45 pm
by grazia
PERFECT!!!

Thank you thank you tank you :-*