2 yabba Feb 27, 2009 08:36

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
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 ---------------------------------
?>
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?
<?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 ---------------------------------
?>
¥
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.
I was bored :P
¥
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
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 ) );
¥
Thank ¥åßßå and EdB for code and guidance. I'm feeling love b2wvolution cumulative.
¥