bloque para mostrar posts como blogspot

No tiene autorización para enviar comentarios.

Snippet para mostrar lista de noticias en un bloque como el archivo de posts de blogspot

<?php
drupal_add_js('(function($) {
$.fn.kshide = function() {
 
return this.each(function() {
var obj = $(this);
var link = obj.children("a");
var list = obj.children("ul");
list.hide();
 
link.toggle(
function() {
$(list).show("fast");
},
function() {
$(list).hide("fast");
});
});
}
})(jQuery);','inline');
 
drupal_add_js('$(document).ready(function(){$(".tog").kshide();});','inline');
?>
<?php
// This template page is for showing blog archives.
//show blog archives from 2007 - 2099 with most recent dates shown first
echo '<ul class="menu">';
for($y = 25; $y >= 7; $y--)
{
$showYear = false;
for($m = 12; $m >= 1; $m--)
{
if (blogList($m,$y))
$showYear = true;
}
if ($showYear)
{
echo '<li class="tog"><a href="#"><h2>'. (2000 + $y) .'</h2></a>';
for($m = 12; $m >= 1; $m--)
{
echo blogList($m,$y);
}
echo '</li>';
}
}
echo '</ul>';
//blog archives
function blogList($month, $year)
{
$lastDate = array(31,29,31,30,31,30,31,31,30,31,30,31);
$beginDate = mkTime(0,0,0, $month, 1, $year);
$endDate = mkTime(0,0,0, $month, $lastDate[$month-1], $year);
//pull all the blogs where month =
$query = db_query('SELECT nid, title, created, type
FROM {node}
WHERE created > '.$beginDate. ' AND created < '.$endDate .' AND type = "bitacora"');
//The_Source: count the number of blogs here for v6.0
//There is probably a better way to do this
$num_blog_nodes = db_result(db_query('SELECT COUNT(*)
FROM {node}
WHERE created > '.$beginDate. ' AND created < '.$endDate .' AND type = "bitacora"'));
$mes = array(
"January"=>"Enero",
"February"=>"Febrero",
"March"=>"Marzo",
"April"=>"Abril",
"May"=>"Mayo",
"June"=>"Junio",
"July"=>"Julio",
"August"=>"Agosto",
"September"=>"Setiembre",
"October"=>"Octubre",
"November"=>"Noviembre",
"December"=>"Diciembre",
);
if($num_blog_nodes > 0)
{
$output = '<ul class="posts"><li class="tog"><a href="#"><h3>'.$mes[date('F', $beginDate)] .'</h3></a><ul class="list">';
while($blog = db_fetch_object($query))
{
$output .= '<li class="post">'.l($blog->title, 'node/'.$blog->nid) .'</li>';
}
$output .= '</ul></li></ul>';
return $output;
}
else
{
return false;
}
}
?>