Powered by MediaWiki
Personal tools

Summary.php

From B2evolution

Jump to: navigation, search

Summary.php is included with every installation of b2evolution as an example of how to put the latest 3 posts from every blog on a single summary page. If you only have 1 blog, or only have 1 blog and a linkblog, you might not need to bother with summary.php.

Summary.php is especially interesting for people with multiple (more than 2) blogs or for use as an overview page for a group.

If you want the capabilities of summary.php but customized to you own site, you can put this code into your own layout. What is the code you need in that page?

Before anything (before <html>)

 <?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
  }  ?>