How to Display 10 Latest Articles at Homepage of X-Cart v4.7.9?

First step, edit postauth.php which is under root folder. Find

$pages_menu = func_query("SELECT * FROM " . $sql_tbl['pages'] . " WHERE language='" . $store_language . "' AND active='Y' AND level='E' AND show_in_menu='Y' ORDER BY orderby, title");

$smarty->assign('pages_menu', $pages_menu);

Add the following codes below them:

//Eyeglasses static pages titles and description begin
$pulled_articles= func_query("SELECT * FROM " . $sql_tbl['pages'] . " WHERE language='" . $store_language . "' AND active='Y' AND level='E' ORDER BY orderby DESC LIMIT 30");

$loupe_articles = array();

foreach ($pulled_articles as $article){

    $pages_dir = $xcart_dir . $smarty_skin_dir . '/pages/' . $article['language'] . "/";

    $filename = $pages_dir.$article['filename'];

    $page_content = func_file_get($filename, true);

    $article['page_content'] = $page_content;

    $loupe_articles[] = $article;

}

$smarty->assign('loupe_articles', $loupe_articles);
//Eyeglasses static pages titles and description end

Second step, go to skin/light_responsive/customer/main/, and edit welcome.tpl, find:

{include file="customer/main/featured.tpl"}

Under it add the following codes:
<div>
<div>
<h2>{$lng.lbl_articles}</h2>
</div>
{foreach from=$loupe_articles item=p name=loupe_articles}
<div>
<h3><a href=”pages.php?pageid={$p.pageid}”>{$p.title|amp}</a></h3>
<div>
{$p.page_content|truncate:250|strip_tags:false}
</div>
</div>
{/foreach}
</div>

Last step, login admin panel, go to content–>language, and find Add new entry:
Add new entry
Select topic: Labels
Variable: lbl_articles
Value: Dental Loupes FAQs

Done!
Demo: http://www.cheapglasses123.com/

 

If we only display latest 10 static page titles at homepage, we can add the following code:

{foreach from=$pages_menu item=p name=static_pages_list}
{if $smarty.foreach.static_pages_list.iteration le 3}
{if $p.show_in_menu eq ‘Y’}
<a href=”pages.php?pageid={$p.pageid}”>{$p.title|amp}</a>
{/if}
{/if}
{/foreach}

 

If we want to display 10 static page titles which Pos is big than 1000, we add the following code:

{foreach from=$pages_menu item=p name=static_pages_list}
{if $p.orderby gt ‘1000’}
<a href=”pages.php?pageid={$p.pageid}”>{$p.title|amp}</a>
{/if}
{/foreach}