Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/10/2010, 09:33
martin0290
 
Fecha de Ingreso: octubre-2009
Mensajes: 84
Antigüedad: 14 años, 6 meses
Puntos: 0
mktime (date) PHP+SQL

Hola gente!, miren tengo una duda haber si esta bien puesto este codigo, lo que quiero yo es que en mi pagina, aya un top de los articlos agradecidos asi que hice esto:

Código:
$spasibo_news = dle_cache( "spasibo-news", $config['skin'] );

if(! $spasibo_news ) {

if( $threenews['on'] == "1" )

$this_week = date( 'Y-m-d', time()-( 3600*24*7 ) );

	$res = $db->query( "SELECT id, title, date, alt_name FROM " . PREFIX . "_post WHERE approve='1' AND date >= '$this_week'AND date < '$this_week' + INTERVAL 1 WEEK ORDER BY spasibo_num DESC LIMIT 0, {$threenews['limit']}" );

	while( $row = $db->get_row( $res ) ) {

	$row['date'] = strtotime( $row['date'] );

	if( strlen( $row['title'] ) > $threenews['titlelimit'] )
		$title = substr( $row['title'], 0, $threenews['titlelimit'] ) . "...";
	else
		$title = $row['title'];

$go_page = ($config['ajax']) ? "onclick=\"DlePage('newsid=" . $row['id'] . "'); return false;\" " : "";

	if ($config['allow_alt_url'] == "yes")
		$link = "<a {$go_page} href=\"" . $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html\">" . stripslashes( $title ) . "</a>";
	else
		$link = "<a {$go_page} href=\"$PHP_SELF?newsid=" . $row['id'] . "\">" . stripslashes( $title ) . "</a>";

	$spasibo_news .= "<div onmouseover=\"this.className='lastcomm_over1';\" onmouseout=\"this.className='lastcomm';\" class=\"lastcomm\"> {$threenews['sstrat']} " . $link . "</div>";
	}
	
	$db->free();
	create_cache( "spasibo-news", $spasibo_news, $config['skin'] );
	
}

Lo que esta en rojo es el código nuevo ya que si no pongo me toma todos los artículos agradecidos y no se actualizaría cada 1 semana

Bueno nose si esta bien puesto, haber si alguien me puede ayudar!!

SALUDOS!