1 managerblue Feb 26, 2009 10:08
3 managerblue 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 yabba 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 managerblue 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 yabba 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 edb 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.
8 yabba Feb 28, 2009 11:20
I was bored :P
¥
9 managerblue 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 yabba 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 managerblue Mar 01, 2009 02:05
Thank ¥åßßå and EdB for code and guidance. I'm feeling love b2wvolution cumulative.
¥