2 esanchez Jan 11, 2010 05:28

On a normal PHP page I would like to show a related blog article
How do you determine a related article, b2evo compares tags? You can integrate b2evo in normal PHP page using the following code
----- Your PHP page above --------
// Load b2evo config
require_once dirname(__FILE__).'/conf/_config.php'; // edit the path
require_once $inc_path.'_main.inc.php';
$BlogCache = & get_Cache('BlogCache');
$Blog = & $BlogCache->get_by_ID( 7, false ); // edit blog ID
load_class( 'items/model/_itemlist.class.php', 'ItemList' );
$RelatedList = & new ItemList2( $Blog, NULL, NULL, 1 ); // load 1 item
$RelatedList->set_filters( array(
'unit' => 'posts',
'tags' => 'tag one, tag two, another_tag', // load posts with these tags (separate with a comma)
), false );
// Run the query:
$RelatedList->query();
if( ! $RelatedList->result_num_rows )
{ // Nothing to display:
return;
}
while( $Item = & $RelatedList->get_item() )
{ // Display contents of the Item. See skins/your_skin/index.main.php for details
$Item->title();
// item content
skin_include( '_item_content.inc.php' );
// item comments
skin_include( '_item_feedback.inc.php' );
}
Not tested, free-typed :)
The best way to do is -- is to really create a skin that allows you to host the blog post... and then use the HTML widget to add HTML parts to the 'skin' (i.e. blog design).
We have the blog piece in the middle and then on the left and right, you have the html web parts... for the books on the left, those are basic html widgets (from b2evo) but then, I linked them to the "To check Edgar's progress, click here" which allows people to read the comments....
this skin is customized for me, but there are other 3 column skins in here you could leverage for your site.
Check out my home page. http://www.TheChristianAlert.org
if you want more help, b2evo version & web site will help the others in the forum..