Module news img url

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
grazia
Forum Members
Forum Members
Posts: 21
Joined: Wed Dec 05, 2012 10:28 am

Module news img url

Post 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
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Module news img url

Post 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}
grazia
Forum Members
Forum Members
Posts: 21
Joined: Wed Dec 05, 2012 10:28 am

Re: Module news img url

Post by grazia »

PERFECT!!!

Thank you thank you tank you :-*
Post Reply

Return to “Modules/Add-Ons”