• 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  [ 5 posts ] 
Author Message
 Post subject: Field Definitions in News and Blog
PostPosted: Thu Aug 02, 2012 5:55 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Feb 08, 2007 6:11 pm
Posts: 506
Location: Florida
carasmo \carasmo:
\$1:
{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.

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


if the field is Mainimage then

\$1:
{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  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Field Definitions in News and Blog
PostPosted: Fri Aug 03, 2012 12:40 am 
Offline
Power Poster
Power Poster

Joined: Fri Mar 30, 2007 2:28 am
Posts: 1015
Location: London
Are you sure you are checking for if a value exists or if just the field name exists.

Should it not be e.g.
\$1:
{if $entry->fieldsbyname.Mainimage->value}
do something
{/if}


Though depends on the field type and default value.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Field Definitions in News and Blog
PostPosted: Fri Aug 03, 2012 12:44 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Feb 08, 2007 6:11 pm
Posts: 506
Location: Florida
If there's nothing in the field, it'd print the container like an empty p tag, so if the value exists then do it. If the image exists, then load the figure tag, etc.,

Haven't tried what you wrote, got the if not empty from elsewhere...


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Field Definitions in News and Blog
PostPosted: Fri Aug 03, 2012 12:54 am 
Offline
Power Poster
Power Poster

Joined: Fri Mar 30, 2007 2:28 am
Posts: 1015
Location: London
Ok just trying suggest a potential shorthand version. Try it.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Field Definitions in News and Blog
PostPosted: Fri Aug 03, 2012 12:58 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu Feb 08, 2007 6:11 pm
Posts: 506
Location: Florida
Thanks! I will.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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:  
A2 Hosting