Display Latest Post

Hi everyone, i need a little help.

Before the blog came a long i used to display the latest news post on the home page with the following code, witch now it will not work. Can any one help mr with it.

{assign var="items" value="$params"|fn_get_pages}

{foreach from=$items[0] item=“news” name=“site_news”}
{* to show 2 or more news then replace 1 with 2 and so on. *}
{if $smarty.foreach.site_news.index < 1 }

{$news.description nofilter}
{/if} {/foreach}

Good day,

There is a built-in feature which allows to show latest post. Why you cannot use it?

http://clip2net.com/s/3neNIKH

Good day,


There is a built-in feature which allows to show latest post. Why you cannot use it?

http://clip2net.com/s/3neNIKH




Good day,


That’s doesn’t work to show the latest post. All that dose is show header and a picture from the latest post. I want the entire first post to show up on the homepage like th code that I have above.

That's doesn't work to show the latest post. All that dose is show header and a picture from the latest post. I want the entire first post to show up on the homepage like th code that I have above.

Additional code modifications are required to show post content in these blocks. Hire someone from this forum to perform this work for you.

I'v figured it out on how to do it, if anyone is interested fell free to use it.

{$params['page_type']="B"}
{$params['get_image']=TRUE}
{$params['status']="A"}
{$params['sort_by']="timestamp"}
{$params['sort_order']="desc"}
{assign var="items" value=$params|fn_get_pages}
{foreach from=$items[0] item="news" name="site_news"}
{* to show 2 or more news then replace 1 with 2 and so on. *}
{if $smarty.foreach.site_news.index < 1 }
    
{$news.description nofilter}
{/if} {/foreach}

The snippet above works yet it only shows the description and nothing else. If you want more then use the following in a new "HTML with Smarty support" block that you create:

Here is a full blog post code:

{$params['page_type']="B"}
{$params['get_image']=TRUE}
{$params['status']="A"}
{$params['sort_by']="timestamp"}
{$params['sort_order']="desc"}
{assign var="items" value=$params|fn_get_pages}
{foreach from=$items[0] item="news" name="site_news"}
{* to show 2 or more news then replace 1 with 2 and so on. *}
	{if $smarty.foreach.site_news.index < 3 }
	

{$news.page}

{$news.timestamp|date_format:"`$settings.Appearance.date_format`"}
{__("by")} {$news.author}
{if $news.main_pair}
{include file="common/image.tpl" image_width="auto" obj_id=$news.page_id images=$news.main_pair}
{/if}
{* use $news.spoiler for the short description or $news.description for the whole article *}
{$news.spoiler nofilter}
{* if you use the full description then you should remove the following Div block. It provides a Read More button that links to the same article in your blog *}
{/if} {/foreach}