Page 1 of 1
Lastest News records
Posted: Wed Jan 13, 2010 1:17 am
by dinoboy
Hi guys
Currently i have trouble with Lastest News records on homepagee
i am trying to get lastest news title and date , show 5 newest records only. look like this:
This is News title one (12/08/2009)
This is News title two (11/08/2009)
This is News title three (10/08/2009)
This is News title four (09/08/2009)
This is News title five (08/08/2009)
Please help me to do that. does CMSms have tag like this : {news_title} {news_date} and how to show only 5 newest records?
thanks
Re: Lastest News records
Posted: Wed Jan 13, 2010 3:15 am
by jmcgin51
create a Summary Template for News, named "title_and_date", and edit it to show the title and date as you want
then use {news number='5' summarytemplate='title_and_date'}
Re: Lastest News records
Posted: Wed Jan 13, 2010 3:25 am
by dinoboy
i read the help file, i should create title_and_date.tpl file and upload it to modules/news/templates {news_title} some text {news_date}
thanks .
Re: Lastest News records
Posted: Wed Jan 13, 2010 3:32 am
by jmcgin51
dinoboy wrote:
thanks, but what should i type in the title_and_date templates?
how to retrieve news title and news date
{news_title} some text {news_date}
have you looked at the default Summary Template (named "Sample")?
Re: Lastest News records
Posted: Wed Jan 13, 2010 3:44 am
by dinoboy
i dont know where to view it? layouts > templates in CMS admin console (i checked but couldnt find it)?? or i must browse it in module/news/template via FTP

Re: Lastest News records
Posted: Wed Jan 13, 2010 4:02 am
by jmcgin51
in the Admin panel, Content > News, then click the Summary Templates tab
Re: Lastest News records
Posted: Wed Jan 13, 2010 6:16 am
by dinoboy
i found it, i create a template file on my pc title_and_date.tpl with this content
Code: Select all
<div class="lastest_news_title">{$entry->titlelink}</div>
<div class="lastest_news_date">$entry->postdate</div>
<br class="clear" />
and use FTP clients to upload it to modules/news/templates
and in my homepage template i insert this code
Code: Select all
{news number='5' summarytemplate='title_and_date'}
then refresh the page, it didnt work, here is the message:
Code: Select all
string(76) "Smarty error: unable to read resource: "module_file_tpl:News;title_and_date""
Re: Lastest News records
Posted: Wed Jan 13, 2010 1:45 pm
by jmcgin51
you do not need to use FTP or create any TPL files
On the Summary Templates tab, there is a link to create a new template. Just use that link, then enter the desired template name, and then customize the template as needed.
Re: Lastest News records
Posted: Thu Jan 14, 2010 2:01 am
by dinoboy
thank you alot i made it.
actually there is no "create new templates" link in summary template tab, i uploaded direct to FTP. it works now ^^
This is the code i use in "title_and_date"
Code: Select all
{foreach from=$items item=entry}
<div class="lastest_news_title">{$entry->titlelink}</div>
<div class="lastest_news_date">{$entry->formatpostdate}</div>
<br class="clear" />
{/foreach}
and in homepage's template i use this code:
Code: Select all
{news number='5' summarytemplate='title_and_date.tpl' dateformat="%x"}
it printed exactly what i want, CMSMS is cool, i have to study more about it... i am a Designer , so every website i designed nad cut html, i do need a Coder to make the website live, i think with CMSMS i dont need a Coder anymore, i can keep all money

thank you again ;)
Re: Lastest News records
Posted: Thu Jan 14, 2010 2:30 am
by jmcgin51
dinoboy wrote:
thank you alot i made it.
actually there is no "create new templates" link in summary template tab, i uploaded direct to FTP. it works now ^^
Actually, there IS a "Create a New Template" link in the Summary Template tab. See the image below.
(Oh, and this installation of News was renamed to "Announcements" at the client's request. That's why the first tab is labeled "Announcements" instead of "News". Otherwise it's the stock News module.)
Glad you got it working...