summary.php
`summary.php` is an example of how to display the latest 3 posts from every blog on a single summary page. Summary.php is especially interesting for people with multiple (more than 2) blogs or for use as an overview page for a group.
`summary.php` is no longer distributed with b2evolution v6+ but you can download it from this page. Just change the extension from `.txt` to `.php` and place the file in your b2evolution base folder.
If you want the capabilities of `summary.php` customized to your own site, you can insert the PHP code into your own layout.
What is the code you need in that page?
<?php
/**
* Check this: we are requiring _main.inc.php INSTEAD of _blog_main.inc.php because we are not
* trying to initialize any particular blog
*/
require(dirname(__FILE__).'/evocore/_main.inc.php');
?>
and on the place where you want the summary of the posts :
<?php
for( $blog=blog_list_start('stub'); $blog!=false; $blog=blog_list_next('stub') )
{ # by uncommenting the following lines you can hide some blogs
// if( $blog == 1 ) continue; // Hide blog 1...
// if( $blog == 2 ) continue; // Hide blog 2...
// if( $blog == 3 ) continue; // Hide blog 3...
// if( $blog == 4 ) continue; // Hide blog 4...
?>
<h3><a href="<?php blog_list_iteminfo('blogurl', 'raw' ) ?>" title="<?php blog_list_iteminfo ( 'shortdesc', 'htmlattr'); ?>"><?php blog_list_iteminfo( 'name', 'htmlbody'); ?></a></h3>
<ul>
<?php // Get the 3 last posts for each blog:
$BlogBList = & new ItemList( $blog, '', '', '', '', '', array(), '', 'DESC', '', 3, '', '', '', '', '', '', '', 'posts' );
while( $Item = $BlogBList->get_item() )
{ ?>
<li>
<a href="<?php $Item->permalink() ?>" title="<?php echo T_('Permanent link to full entry') ?>"><?php $Item->title( '', '', false ); ?></a>(<?php $Item->issue_date() ?>)
</li>
<?php } ?>
<li><a href="<?php blog_list_iteminfo('blogurl', 'raw' ) ?>"><?php echo T_('More posts...') ?></a></li>
</ul>
<?php
} ?>
Attachments:
- summary.txt (6.5 KB)