Lastest News records

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
dinoboy
Forum Members
Forum Members
Posts: 11
Joined: Wed Jan 13, 2010 1:11 am

Lastest News records

Post 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
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Lastest News records

Post 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'}
dinoboy
Forum Members
Forum Members
Posts: 11
Joined: Wed Jan 13, 2010 1:11 am

Re: Lastest News records

Post 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 .
Last edited by dinoboy on Wed Jan 13, 2010 3:32 am, edited 1 time in total.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Lastest News records

Post 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")?
dinoboy
Forum Members
Forum Members
Posts: 11
Joined: Wed Jan 13, 2010 1:11 am

Re: Lastest News records

Post 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 ???
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Lastest News records

Post by jmcgin51 »

in the Admin panel, Content > News, then click the Summary Templates tab
dinoboy
Forum Members
Forum Members
Posts: 11
Joined: Wed Jan 13, 2010 1:11 am

Re: Lastest News records

Post 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"" 
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Lastest News records

Post 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.
dinoboy
Forum Members
Forum Members
Posts: 11
Joined: Wed Jan 13, 2010 1:11 am

Re: Lastest News records

Post 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  :D
thank you again  ;)
Last edited by dinoboy on Thu Jan 14, 2010 2:17 am, edited 1 time in total.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Lastest News records

Post 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...
Attachments
create_a_new_summary_template.JPG
Last edited by jmcgin51 on Thu Jan 14, 2010 2:33 am, edited 1 time in total.
Post Reply

Return to “CMSMS Core”