Recent Topics

display a sideblog

Started by on Jan 25, 2004 – Contents updated: Jan 25, 2004

Jan 25, 2004 20:21    

i tried to implement a sideblog into my sidebar. i made it by using this code


	<?php
		// Dirty trick until we get everything into objects:
		$saved_blog = $blog;  
		$blog = 5;		// Blogroll now
	?>
		<h3><a href="<?php bloginfo('blogurl', 'raw') ?>"><?php echo bloginfo( 'name', 'html' ) ?></a></h3>
	<?php
		$BlogRollList = new ItemList( $blog,  $show_statuses, '', $m, $w, '', array(), $author, $order, $orderby, $posts, '', '', '', '', '', '', '', '15', 'posts', $timestamp_min, $timestamp_max );
		
		while( $BlogRollList->get_item() )
		{
?>
		<div class="bPostSide" lang="<?php the_lang() ?>">
			<?php permalink_anchor(); ?>
	
			<div class="bText">
				<?php the_content( '#', 0, '', '#', '', '', 'htmlbody', 0, 0, 1, 1);?>(<?php the_time( 'd.m.y' );?>)
			</div>
		</div>
		<?php
		}
		
		// Restore after dirty trick:
		$blog = $saved_blog;		
	?>

the only problem i have:

actually the items are listed as

content of item 1 (date 1)
content of item 2 (date 1)
content of item 3 (date 2)
content of iitem 4 (date 3)
...

but i would prefer

date 1
content of item 1
content of item 2

date 2
content of item 3

date 3
content of item 4
...

i don't know how to do this with get->item()
any hints?

Jan 25, 2004 20:31

Try this:

   <?php
      // Dirty trick until we get everything into objects:
      $saved_blog = $blog; 
      $blog = 5;      // Blogroll now
   ?>
      <h3><a href="<?php bloginfo('blogurl', 'raw') ?>"><?php echo bloginfo( 'name', 'html' ) ?></a></h3>
   <?php
      $BlogRollList = new ItemList( $blog,  $show_statuses, '', $m, $w, '', array(), $author, $order, $orderby, $posts, '', '', '', '', '', '', '', '15', 'posts', $timestamp_min, $timestamp_max );
      
      while( $BlogRollList->get_item() )
      {
?>
      <div class="bPostSide" lang="<?php the_lang() ?>">
         <?php permalink_anchor(); ?>
   
         <div class="bText">
             <?php the_date() ?>
            <?php the_content( '#', 0, '', '#', '', '', 'htmlbody', 0, 0, 1, 1);?>
         </div>
      </div>
      <?php
      }
      
      // Restore after dirty trick:
      $blog = $saved_blog;      
   ?>

Does that work the way you want it to? :-/

-Vegar

Jan 25, 2004 21:11

many many thanks. it works and it rocks :-)

but i understand, why it works. it seems you only moved the

<?php the_date() ?> 

or am i missing something?

Jan 25, 2004 21:15

The function the_date() is written so that with several posts of the same date, the date will only be displayed once. the_time(), however, is always displayed. And setting the attribute for the the_time() function as "d.m.Y" makes it output the date after every single post, which is what you wanted to avoid. :)

-Vegar

Jan 25, 2004 21:20

i begin to understand how b2evolution and it's function is working. absolutly great.
many thanks for the quick help.

Mar 09, 2005 04:02

I tried including that code in my sidebar and I got this:

Output format [html] not supported.

Any ideas?

Mar 09, 2005 09:28

Because that was written a year ago and for an old version. You will need to use the updated tags. Look at multiblogs.php

Mar 09, 2005 11:27

Anyone prepared to give up the updated code for a b2evo user too lazy to dig through updatelogs?

Mar 09, 2005 11:44

Like I said, look at multiblogs.php. It's pretty obvious which tags should be replaced with which.

Mar 09, 2005 16:56

Graham wrote:

Like I said, look at multiblogs.php. It's pretty obvious which tags should be replaced with which.

Obvious to some perhaps...

Anyway, I figure the easiest way of doing this is to use multiblogs.php . How do I set multiblogs to be the default page on the site?

Mar 09, 2005 17:13

make for all your blogs stubfiles.
Look that none of the blogs are like 'default weblog on index.php'
and that none are : 'other weblog trough index.php'
so : none of your blogs is using index.php

than
rename index.php to indexold.php (you will never know when you want it back)
rename multiblogs.php to index.php

Mar 09, 2005 17:58

Thanks Topanga. I did try and figure out how to create a date-ordered sidelog by nicking code from the multiblogs file in the end and what do you know: it worked. It doesn't look great yet, but at least I've got an alphabetical linkblog and a date-ordered sidelog on the right-hand side of the page now :D


Form is loading...

Content Mangement System – This forum is powered by b2evolution CMS, a complete engine for your website.