News blog's recent 5 posts on home page, HOW?

News blog's recent 5 posts on home page, HOW?

Postby faras on Wed Aug 04, 2010 6:24 am

I want to poot one blogs recent 5 post's on site main page. for example news.mysite.com 's recent 5 post on home page as site news.
I think we can do it with blog's RSS URL.
if some one can do it, please give me the code.
faras
 
Posts: 6
Joined: Mon Aug 02, 2010 12:56 pm
LifeType Version: 1.2.10

Re: News blog's recent 5 posts on home page, HOW?

Postby jondaley on Wed Aug 04, 2010 5:20 pm

You want something like this: (didn't test it at all, just wrote it from memory, so I might have missed a parameter or syntax error or something.

Code: Select all
$blogId=1;
$numArticles = 5;
$articles = new Articles();
$arts = $articles->getBlogArticles( $blogId, -1, $numArticles, -1);
foreach($arts as $article){
  print "<h1>".$article->getTopic()."</h1>";
  print "<div>".$article->getText()."</div>";
}
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: News blog's recent 5 posts on home page, HOW?

Postby faras on Thu Aug 05, 2010 9:36 am

Thank yuou so much for your reply. but as you said it is not correct code for my request.
please correct it and help me to show one blog's 5 recent posts on home page as site news.
I think you can do it, I am not profetional in LifeType code.
Please show in code where should I paste blog RSS2 URL.
I need just post's title for home page. templates/summary/index.template
faras
 
Posts: 6
Joined: Mon Aug 02, 2010 12:56 pm
LifeType Version: 1.2.10

Re: News blog's recent 5 posts on home page, HOW?

Postby faras on Sun Aug 15, 2010 11:15 am

HEY
I am looking forward to hearing form you, please help me in this case :cry:
faras
 
Posts: 6
Joined: Mon Aug 02, 2010 12:56 pm
LifeType Version: 1.2.10

Re: News blog's recent 5 posts on home page, HOW?

Postby jondaley on Thu Aug 19, 2010 12:45 pm

What problem did you have?
I'm not sure what you mean by the templates/summary/index.template sentence?

And what are you asking about the RSS URL? You could just type in an <a href...>, or <link href...> to a hard-coded RSS feed - no need to dynamically generate the RSS url, since you are only getting it for one blog?
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch


Return to Requests and Suggestions

cron