• 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: News Module: Calling 'Fields' Indivually in a template
PostPosted: Thu Feb 07, 2008 1:22 pm 
Offline
Forum Members
Forum Members
User avatar

Joined: Wed Feb 07, 2007 2:36 pm
Posts: 104
An associate had a problem with this and Walkere touched on it briefly in this post but I just want to clarify it:

You can display 'field definitions' individually quite simply.

When you add 'Field definitions' to the news module, by default they are all be displayed with the following code:

Code:
{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     <div class="NewsDetailField">
        {if $field->type == 'file'}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {$field->name}: {eval var=$field->value}
        {/if}
     </div>
  {/foreach}
{/if}


Not so great if you want to have different types of news items, or if you want to move those fields about a bit.

To display them on there own, you simply use the smarty syntax {$entry->field_name}, Where 'field_name' is the name of any added field definitions with underscores '_' replacing any spaces.

So, for example, if you enter a field called 'News Author', this could be called in a template using {$entry->news_author}.

If you had an image upload field called 'News Thumbnail', this called be called using, {$entry->news_image} which would output only the name of the uploaded file, eg, 'news-image-01.jpg'.

To take that further you could build an image using the following line:

Code:
<img src="/uploads/news/id{$entry->id}/{$entry->news_image}" alt="{$entry->title}" width="75" height="75"/>


As the default location for uploads fields is: 'SITEROOT/uploads/news/id3' where the final ID folder is determined by the news item.

Hope this helps out, sorry if this is added elsewhere and thanks again to all those working so hard on the news module, great work.

;)

D

_________________
// Expression Theme 1.0.2 (expression-admin.tar.gz, 501kb)

// Found a bug or have a suggestion please post it here.

// @heymyshko


Last edited by myshko on Thu Feb 07, 2008 1:23 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: News Module: Calling 'Fields' Indivually in a template
PostPosted: Mon Feb 11, 2008 11:11 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Wed Jan 09, 2008 10:10 pm
Posts: 264
Location: USA
Dang it!  I wish I had found this 2 days ago.  I was sooo close.  Didn't realize (or dig into it) that those field names got normalized...

If the field is named PageId use {$entry->pageid}

Thank you for posting this.  I need to browse the Tips&Tricks more often.

DOH:
http://forum.cmsmadesimple.org/index.ph ... 293.0.html


Top
 Profile  
 
 Post subject: Re: News Module: Calling 'Fields' Indivually in a template
PostPosted: Tue Jul 08, 2008 10:44 am 
Offline
Forum Members
Forum Members

Joined: Thu Apr 17, 2008 9:02 pm
Posts: 167
Hey guys

im looking to add images to my news items, i was looking at this post but i need some guidance on what code to add where in the template or stylesheet to allow me to add images to my news posts.

Can you helP?


Top
 Profile  
 
 Post subject: Re: News Module: Calling 'Fields' Indivually in a template
PostPosted: Tue Jul 08, 2008 10:57 am 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 11812
Location: Arizona
How do you mean add images, in the content or summary you can add image like in page edit mode?...

_________________
Extensions » Modules/Tags click the name of the module/tag or Help to the right to get its parameters.
Right click and view source is a great way to see what you have to work with.
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/
Image


Top
 Profile  
 
 Post subject: Re: News Module: Calling 'Fields' Indivually in a template
PostPosted: Tue Jul 08, 2008 6:09 pm 
Offline
Forum Members
Forum Members

Joined: Thu Apr 17, 2008 9:02 pm
Posts: 167
well on my static sites i use a multi news rotational thing called frontpage which is actually created by a joomla guy heres example of what its like

linky

i want to have a similar thing on my cms site, only i would like it setup so that the 4 most recently added news items go into the main page rotator which would look something like this:

linky

you understand?

a friend of mine has succesffully incorporated it into his wordpress site here linky


and i would like to do it with cms


check this post out

http://forum.cmsmadesimple.org/index.ph ... 604.0.html


Last edited by buntrosgali on Tue Jul 08, 2008 9:00 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: News Module: Calling 'Fields' Indivually in a template
PostPosted: Mon Feb 07, 2011 6:22 pm 
Offline
New Member

Joined: Sun Nov 02, 2008 10:56 am
Posts: 2
Just a quick tidbit -if you have '-' dashes in your field names this doesn't work, use '_' underscores instead.


Top
 Profile  
 
 Post subject: Re: News Module: Calling 'Fields' Indivually in a template
PostPosted: Mon Feb 07, 2011 6:50 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 11812
Location: Arizona
You can use the jqery cycle plugin, I've used it many times, for news etc...

_________________
Extensions » Modules/Tags click the name of the module/tag or Help to the right to get its parameters.
Right click and view source is a great way to see what you have to work with.
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/
Image


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:  
A2 Hosting