How to Let X-Cart Display latest WordPress Posts?

This mod assumes that you use the WordPress blogging software and uses the same database as your xcart software.
If your wordpress and x-cart use separate database then use this code for blog_headlines.php


array());
$smarty->assign("blog_headlines", $blog_headlines);

#Connect to the X-Cart database - these variables are in config.php
db_connect($sql_host, $sql_user, $sql_password);
db_select_db($sql_db);

?>

If you do not use the default WordPress SQL table prefix than you will need to specify it in the select query.
For example, change wp_posts to yourprefix_posts

Create xcart-root/include/blog_headlines.php and paste this in it:


array());
$smarty->assign("blog_headlines", $blog_headlines);
?>

Create xcart-root/skin1/blog_headlines.tpl and paste this in it:

Latest Blog Posts

{foreach from=$blog_headlines item=bh}

{$bh.post_title}
{$bh.post_content|truncate:200:"...":true}

{/foreach}

Open xcart-root/init.php and add this at the end:

#Blog Headlines
include($xcart_dir."/include/blog_headlines.php");

Open xcart-root/skin1/skin1.css and add this:

/*** Blog Headlines Styles Start ***/
a.blog_headlines { /* The link */
display:block;
}
a.blog_headlines:hover { /* The link when hovered over */
background:#d7d7d7;
}
hr.blog_headlines { /* The line */
color:#e1e1e1;
}
div.blog_headlines { /* The date */
float:right;
}
br.blog_headlines{
clear:left;
}
/*** Blog Headlines Styles End ***/

Open xcart-root/skin1/customer/home.tpl file and add this within VertMenuLeftColumn (or where ever appropriate):

{include file=”blog_headlines.tpl”}

——————

More display sample:
Create xcart-root/skin1/blog_headlines.tpl and paste this in it:

{* $Id: blog_headlines.tpl,v1 09/01/29 11:18:59 max Exp $ *}
{capture name=menu}
{foreach from=$blog_headlines item=bh}{$bh.post_title}

{$bh.post_date}



{/foreach}
{/capture}
{include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title="Blog Headlines" menu_content=$smarty.capture.menu}

King Php Science Welcome, you are from: 54.205.172.57