SOLVED: Field Definitions in News Module

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
KW2912
Forum Members
Forum Members
Posts: 14
Joined: Thu May 23, 2013 1:52 pm

SOLVED: Field Definitions in News Module

Post by KW2912 »

Hi there,

Sorry if this has already been answered but I've searched the forums with no luck. Quick question form a smarty tag newbie:

I've created extra field definitions in news module for certain types of news categories / articles - now I would like to be able to style the field definitions when they are included in the article(s). I've tried various ways but I've been having trouble displaying them let alone styling them.

I've tried:

Code: Select all

{if $customfieldscount gt 0}
      {foreach from=$customfields item=customfield}
            {capture assign=$customfield->name}{$customfield->value}{/capture}
      {/foreach}
{/if}
at the top of the page followed by:

Code: Select all

{$your_field_name}
to display my field definition (inside a DIV to try and style it that way) but can't seem to be able to get them to output into the article.

I'm using:

Code: Select all

{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     <div class="NewsDetailField">
        {if $field->type == 'file'}
	  {* this template assumes that every file uploaded is an image of some sort, because News doesn't distinguish *}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {eval var=$field->value}
        {/if}
     </div>
  {/foreach}
{/if}
to display ALL of my custom fields but this is not ideal. I've ensured that the field definition names don't contain any spaces and simply need the ability to position them inside separate divs something like this (The ones with ** are the fields causing me the problems)

Article Title
Article Date
<underline>
Category Name
Posted By

Article Introduction

**UK Version **Russian Version
**Story Title **Story Title
**Story Audio Link **Story Audio Link
**Main Story Text **Main Story Text

Apologies if this has been asked before or if it's really simple to do but I'm running out of time on a project and could do with some direction.

Thanks in advance for any help you can provide.
Last edited by KW2912 on Mon May 27, 2013 3:42 pm, edited 1 time in total.
KW2912
Forum Members
Forum Members
Posts: 14
Joined: Thu May 23, 2013 1:52 pm

SOLVED: Field Definitions in News Module

Post by KW2912 »

So I think I've solved it myself and managed to find the call command for individual field definitions.

Have used:

Code: Select all

{$entry->fields.story_title_uk->value}
and working like a charm for all my fields.

Sorry folks - guess I didn't look hard enough. Thanks anyway.
Post Reply

Return to “Modules/Add-Ons”