Hello
I have a field definitions called "mainimage" (public). I put the full url of an image in that field, but it is not displaying during the news summary output. I had this working in the version1.10.3 is it a bug or am I doing something wrong in the code?
{foreach from=$items item=entry}
{if isset($entry->mainimage)}
<img src="{eval var=$entry->mainimage}"/>
{/if}
<strong><a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a></strong>
{/foreach}
[solved] News: Field Definitions not working v 1.11
[solved] News: Field Definitions not working v 1.11
Last edited by hanover on Fri Aug 03, 2012 6:45 am, edited 1 time in total.
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: News: Field Definitions not working v 1.11
Custom Field values are no longer 'munged' and copied into the main 'entry' object.
You must access them via the $entry->fields array.
You must access them via the $entry->fields array.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: News: Field Definitions not working v 1.11
Hi Calguy
Thank you for the reply. I am not an expert, is it possible for you to show an example?
Thank you for the reply. I am not an expert, is it possible for you to show an example?
Re: News: Field Definitions not working v 1.11
From the sample summary template I used the "extra" field as a template
{if isset($entry->extra)}
<div class="NewsSummaryExtra">
{eval var=$entry->extra}
</div>
{/if}
but my custom field name is "mainimage"
{if isset($entry->extra)}
<div class="NewsSummaryExtra">
{eval var=$entry->extra}
</div>
{/if}
but my custom field name is "mainimage"
Re: News: Field Definitions not working v 1.11
Code: Select all
{if $entry->fieldsbyname.mainimage != ''} {*if the field is not empty*}
{$entry->fieldsbyname.mainimage->value}
{/if}
if the field is Main Image (not mainimage) note the caps and the space, then that's a different matter.
Code: Select all
{assign var='mainimage' value='Main Image'}
{if $entry->fieldsbyname.$mainimage != ''}
{$entry->fieldsbyname.$mainimage->value}{/if}
Code: Select all
{if $entry->fieldsbyname.Mainimage != ''}
{$entry->fieldsbyname.Mainimage->value}{/if}
Re: News: Field Definitions not working v 1.11
Hi Carasmo
Works perfectly, absolutely fantastic.
Thank you so much.
Works perfectly, absolutely fantastic.
Thank you so much.
Re: News: Field Definitions not working v 1.11
Cool. Now go and edit your original and stick a [solved] before it.