• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: [solved] News: Field Definitions not working v 1.11
PostPosted: Tue Jul 31, 2012 1:24 pm 
Offline
Forum Members
Forum Members

Joined: Fri Jul 13, 2012 8:26 am
Posts: 14
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}


Last edited by hanover on Fri Aug 03, 2012 6:45 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: News: Field Definitions not working v 1.11
PostPosted: Tue Jul 31, 2012 1:50 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 6609
Location: Fernie British Columbia, Canada
Custom Field values are no longer 'munged' and copied into the main 'entry' object.

You must access them via the $entry->fields array.

_________________
Follow me on twitter
--
if you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
----------------
Don't make me angry..... you won't like me when I'm angry....


Top
 Profile  
 
 Post subject: Re: News: Field Definitions not working v 1.11
PostPosted: Tue Jul 31, 2012 1:59 pm 
Offline
Forum Members
Forum Members

Joined: Fri Jul 13, 2012 8:26 am
Posts: 14
Hi Calguy
Thank you for the reply. I am not an expert, is it possible for you to show an example?


Top
 Profile  
 
 Post subject: Re: News: Field Definitions not working v 1.11
PostPosted: Wed Aug 01, 2012 6:03 am 
Offline
Forum Members
Forum Members

Joined: Fri Jul 13, 2012 8:26 am
Posts: 14
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"


Top
 Profile  
 
 Post subject: Re: News: Field Definitions not working v 1.11
PostPosted: Wed Aug 01, 2012 9:45 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Feb 08, 2007 6:11 pm
Posts: 482
Location: Florida
Code:
{if $entry->fieldsbyname.mainimage != ''} {*if the field is not empty*}

{$entry->fieldsbyname.mainimage->value}

{/if}


Then you put the one with the -> value in the image tag

if the field is Main Image (not mainimage) note the caps and the space, then that's a different matter.

Code:
{assign var='mainimage' value='Main Image'}
{if $entry->fieldsbyname.$mainimage != ''}
{$entry->fieldsbyname.$mainimage->value}{/if}


if the field is Mainimage then

Code:
{if $entry->fieldsbyname.Mainimage != ''}
{$entry->fieldsbyname.Mainimage->value}{/if}


Notice it's case sensitive mainimage is not Mainimage and Main Image is not main_image. You would use the appropriate syntax for the job.


Top
 Profile  
 
 Post subject: Re: News: Field Definitions not working v 1.11
PostPosted: Thu Aug 02, 2012 4:08 pm 
Offline
Forum Members
Forum Members

Joined: Fri Jul 13, 2012 8:26 am
Posts: 14
Hi Carasmo

Works perfectly, absolutely fantastic.

Thank you so much.


Top
 Profile  
 
 Post subject: Re: News: Field Definitions not working v 1.11
PostPosted: Thu Aug 02, 2012 9:52 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Feb 08, 2007 6:11 pm
Posts: 482
Location: Florida
Cool. Now go and edit your original and stick a [solved] before it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
A2 Hosting