Recent Topics

1 Feb 26, 2009 10:08    

My b2evolution Version: Not Entered

I set default.php is home page that have a problem. How to set limit 10 blog in "Blogs on blogtika system" refer to www.blogtika.com

Now, when new user sign up to system. Home page update new blog in "Blogs on blogtika system" can not set limit to 10 blog.

This is code "BLOG LIST"

<?php // --------------------------- BLOG LIST -----------------------------
		for( $l_Blog = & $BlogCache->get_first();
					! is_null( $l_Blog );
					 $l_Blog = & $BlogCache->get_next() )
		{ # by uncommenting the following lines you can hide some blogs
			// if( $curr_blog_ID == 2 ) continue; // Hide blog 2...
			echo '<li><strong>';
			printf( T_(''), $l_Blog->ID );
			echo ': <a href="'.$l_Blog->gen_blogurl().'" title="'.$l_Blog->dget( 'shortdesc', 'htmlattr' ).'">';
			$l_Blog->disp( 'name' );
			echo '</a></strong>';
			echo '</li>';
		}
		// ---------------------------------- END OF BLOG LIST ---------------------------------
?>

8| If i can't set limit blog in home page. Oh, maybe more blog show in my website. "I hope" :lol:

2 Feb 27, 2009 08:36

<?php // --------------------------- BLOG LIST -----------------------------
$blog_count = 0;
      for( $l_Blog = & $BlogCache->get_first();
               ! is_null( $l_Blog );
                $l_Blog = & $BlogCache->get_next() )
      { # by uncommenting the following lines you can hide some blogs
         // if( $curr_blog_ID == 2 ) continue; // Hide blog 2...
$blog_count++;
if( $blog_count > 10 )
{
  continue;
}
         echo '<li><strong>'; 

¥

3 Feb 27, 2009 14:23

When i use this code it can not show everything in "Blogs on blogtika system" :-/

<?php // --------------------------- BLOG LIST ----------------------------- 
$blog_count = 0; 
      for( $l_Blog = & $BlogCache->get_first(); 
               ! is_null( $l_Blog ); 
                $l_Blog = & $BlogCache->get_next() ) 
      { # by uncommenting the following lines you can hide some blogs 
         // if( $curr_blog_ID == 2 ) continue; // Hide blog 2... 
$blog_count++; 
if( $blog_count > 10 ) 
{ 
  continue; 
} 
         echo '<li><strong>';
		}
		// ---------------------------------- END OF BLOG LIST ---------------------------------
?>

Thank ¥åßßå. I maybe don't sure for php code. Please, review my code and help edit right php code for limit 10 blog. :p

4 Feb 27, 2009 16:09

Now I'm confused :

managerblue wrote:

When i use this code it can not show everything in "Blogs on blogtika system" :-/

managerblue wrote:

Please, review my code and help edit right php code for limit 10 blog. :p

¥

*edit*

The end of your code should look like this :

        echo '<li><strong>';
         printf( T_(''), $l_Blog->ID );
         echo ': <a href="'.$l_Blog->gen_blogurl().'" title="'.$l_Blog->dget( 'shortdesc', 'htmlattr' ).'">';
         $l_Blog->disp( 'name' );
         echo '</a></strong>';
         echo '</li>';
      }
      // ---------------------------------- END OF BLOG LIST ---------------------------------
?>

5 Feb 27, 2009 18:58

Some problem about code:

<?php // --------------------------- BLOG LIST ----------------------------- 
$blog_count = 0; 
      for( $l_Blog = & $BlogCache->get_first(); 
               ! is_null( $l_Blog ); 
                $l_Blog = & $BlogCache->get_next() ) 
      { # by uncommenting the following lines you can hide some blogs 
         // if( $curr_blog_ID == 2 ) continue; // Hide blog 2... 
$blog_count++; 
if( $blog_count > 10 ) 
{ 
  continue; 
} 
		 echo '<li><strong>'; 
         printf( T_(''), $l_Blog->ID ); 
         echo ': <a href="'.$l_Blog->gen_blogurl().'" title="'.$l_Blog->dget( 'shortdesc', 'htmlattr' ).'">'; 
         $l_Blog->disp( 'name' ); 
         echo '</a></strong>'; 
         echo '</li>'; 
      } 
      // ---------------------------------- END OF BLOG LIST --------------------------------- 
?> 


When i edit code it's ok but setting-up of blog is problem because homepage show (old blog to new blog) when user regiter new blog can not to show on home page it show old blog 1-10 only(don't show 11,12,...) i would like to show (new blog to old blog) only limit 10 (New blog).

And second problem when i use this code. Home page show look strange it about css or other?

6 Feb 28, 2009 11:12

 <?php // --------------------------- BLOG LIST ----------------------------- 
$output = Array(); 
for( $l_Blog = & $BlogCache->get_first(); 
         ! is_null( $l_Blog ); 
          $l_Blog = & $BlogCache->get_next() ) 
{ # by uncommenting the following lines you can hide some blogs 
   // if( $curr_blog_ID == 2 ) continue; // Hide blog 2... 
   $output[] = '<li><strong>'
			.$l_Blog->ID
			.' : <a href="'.$l_Blog->gen_blogurl().'" title="'.$l_Blog->dget( 'shortdesc', 'htmlattr' ).'">'
			.$l_Blog->dget( 'name' )
			.'</a></strong>'
			.'</li>'; 
} 
echo array_reverse( array_slice( array_reverse( $output ), 0, 10 ) );
// ---------------------------------- END OF BLOG LIST --------------------------------- 
?>

¥

7 Feb 28, 2009 11:19

WARNING!
Mixing array_reverse and array_slice with another array_reverse should only be done by professionals.

Or someone into reversing a sliced reversed array.

Just sayin' is all.

9 Feb 28, 2009 18:57

This code

<?php // --------------------------- BLOG LIST -----------------------------  
$output = Array();  
for( $l_Blog = & $BlogCache->get_first();  
         ! is_null( $l_Blog );  
          $l_Blog = & $BlogCache->get_next() )  
{ # by uncommenting the following lines you can hide some blogs  
   // if( $curr_blog_ID == 2 ) continue; // Hide blog 2...  
   $output[] = '<li><strong>' 
            .$l_Blog->ID 
            .' : <a href="'.$l_Blog->gen_blogurl().'" title="'.$l_Blog->dget( 'shortdesc', 'htmlattr' ).'">' 
            .$l_Blog->dget( 'name' ) 
            .'</a></strong>' 
            .'</li>';  
}  
echo array_reverse( array_slice( array_reverse( $output ), 0, 10 ) ); 
// ---------------------------------- END OF BLOG LIST ---------------------------------  
?>  


It show only word "Array" (no show new blog list) in "Blogs on blogtika system" :o

10 Feb 28, 2009 22:55

Sorry, I was so busy exploding with pointless reverses that I forgot I was echoing an array :-S

change the echo line to :-

echo implode( "\n", array_slice( $output, -10 ) );

¥

11 Mar 01, 2009 02:05

Thank ¥åßßå and EdB for code and guidance. I'm feeling love b2wvolution cumulative.


Form is loading...