 |
 |
Menú principal |
 |
|
|
|
 |
dzStaffStatus |
 |
 |
Administradores |
|
el_cuervo |
|
|
Dixso |
|
 |
Colaboradores |
|
AnyKiller |
|
|
nestormateo |
|
|
docser |
|
 |
Moderadores |
|
cardiru |
|
|
javiermisol |
|
 |
Traductores |
|
gnrx |
|
 |
Miembros: |
 |
Nuevos Hoy: |
1 |
 |
Nuevos Ayer: |
7 |
 |
Total: |
71472 |
 |
Ultimo: |
| agosto_isaac |
 |
Conectados |
 |
Miembros: |
4 |
 |
Invitados: |
64 |
 |
Total: |
68 |
 |
Miembros Online |
 |
abracadabra |
|
 |
nestormateo |
|
 |
jeshua3001 |
|
 |
agosto_isaac |
|
|
|
|
 |
Sponsor |
 |
|
|
|
 |
dp-Tools |
 |
|
|
|
 |
Enlázanos |
 |
|
|
|
Theme creado por dev-postnuke.com |  |  | |  |
|
|
|
tollelle
|
|
|
Enviado: 21/12/2004 a las 18:12 |
|
Forero
Karma: 0 (1 Votos)
Registrado: 11/07/03
Mensajes: 109
Estado: Desconectado Ultima visita: 31/05/06 |
Estoy intentando modificar el Bloque Subject para que me muestre SOLO los ultimos articulos de determinadas categorías.
Supuestamente (segun mi poca experiencia) deberia de conseguirse mediante estos dos trozos de código:
[php] $result2 = $dbconn->SelectLimit("SELECT $column[pagedatetime]
FROM $pntable[subpages]
WHERE $column[subid] = $subid AND
$column[subid] = 13 OR $column[subid] = 14 OR $column[subid] = 15 OR $column[subid] = 16 OR $column[subid] = 20 OR $column[subid] = 21 AND
$column[pageactive] = 1 AND $column[parentpageid] = 0 AND
$column[pagedatetime] < '$now'
ORDER BY $column[pagedatetime] DESC", 1);
[/php]
[php] $result = $dbconn->SelectLimit("SELECT $column[subid], $column[subname],
$column2[pageid], $column2[pagetitle],
$column2[pagetext], $column2[pagedatetime],
$column2[pagecounter]
FROM $pntable[subjects], $pntable[subpages]
WHERE $column[subid] = $column2[subid] AND
$column[subid] = 13 OR $column[subid] = 14 OR $column[subid] = 15 OR $column[subid] = 16 OR $column[subid] = 20 OR $column[subid] = 21 AND
$column[subactive] = 1 $querylang AND
$column2[pageactive] = 1 AND $column2[parentpageid] = 0 AND
$column2[pagedatetime] < '$now'
ORDER BY $column2[pagedatetime] DESC", $pagesamount);
[/php]
Pero solo me muestra el ultimo articulo repetido tantas veces como ultimas supuestas paginas le pongo a la configuracion del bloque.
¿Agluien sabe que está fallando??
Aqui les pongo el codigo completo
[codigo] <?php
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Jaroslaw Gilewski (http://www.yagi.com.pl)
// Purpose of file: Display subjects manu block
// ----------------------------------------------------------------------
$blocks_modules['ultimos_articulos']=array(
'func_display'=>'blocks_ultimos_articulos_block',
'func_add' => 'blocks_ultimos_articulos_add',
'func_update' => 'blocks_ultimos_articulos_update',
'func_edit' => 'blocks_ultimos_articulos_edit',
'text_type'=>'ultimos_articulos',
'text_type_long'=>'ultimos_articulos Menu',
'allow_multiple'=>false,
'form_content'=>false,
'form_refresh'=>false,
'show_preview'=>true);
// Security
pnSecAddSchema('ultimos_articulosBlock::', 'Block title::');
function blocks_ultimos_articulos_block($row)
{
global $pntable, $mod;
list($dbconn) = pnDBGetConn();
$currentlang = pnUserGetLang();
if (!pnSecAuthAction(0, 'ultimos_articulosBlock::', "$row[title]::", ACCESS_READ)) {
return;
}
$url = explode('|', $row['url']);
if (!$url[0]){
$row['content'] = _SB_NOSUBJECTSMODULENAME;
return themesideblock($row);
}
if (!$url[1]){
$url[1] = 0;
}
if (!$url[4]){
$url[4] = 0;
}
$mod = $url[0];
$pagesamount = $url[1];
$pagesdesc = $url[2];
$pagesshort = $url[3];
$reviewsamount = $url[4];
if($row['position'] == 'c'){
$blockrow = 1;
if($pagesamount > 0){
$blockrow++;
}
if($reviewsamount > 0){
$blockrow++;
}
$colwidth = 100/$blockrow;
} else
$colwidth = 100;
include("modules/$mod/pntables.php");
$column = &$pntable['subjects_column'];
if (pnConfigGetVar('multilingual') == 1) {
$querylang = "AND ($column[sublanguage]='$currentlang' OR $column[sublanguage]='')";
} else
$querylang = "";
$column2 = &$pntable['subcategories_column'];
$result = $dbconn->Execute("SELECT $column[subid], $column2[catid],
$column2[catname], $column[subname]
FROM $pntable[subjects]
LEFT JOIN $pntable[subcategories]
ON $column[catid]=$column2[catid]
WHERE $column[subactive] = 1 $querylang
ORDER BY $column2[catorder], $column[suborder]");
///////////TABLA GENERAL//////////////
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> | ";
$content .= "";
if (!$result->EOF) {
$currcatid = 0;
while(list($subid, $catid, $catname, $subname) = $result->fields) {
$now = date("Y-m-d H:i:00");
$column = &$pntable['subpages_column'];
$result2 = $dbconn->Execute("SELECT COUNT(*)
FROM $pntable[subpages]
WHERE $column[subid]=$subid AND $column[parentpageid]=0 AND
$column[pagedatetime] < '$now'");
list($pagesattached) = $result2->fields;
$result2->Close();
if($currcatid != $catid){
if($content == "")
$content .= "";
else
$content .= "";
$currcatid = $catid;
}
if (pnSecAuthAction(0, 'ultimos_articulos::Subjects', "$subname::$subid", ACCESS_READ)) {
$content .= "";
$now = date("Y-m-d H:i:00");
$column = &$pntable['subpages_column'];
//// WHERE ...... 134 $column[subid] = 4 AND [ 4 Numero de la CATEGORIA ultimos_articulos Y ARTISTAS ] ////
$result2 = $dbconn->SelectLimit("SELECT $column[pagedatetime]
FROM $pntable[subpages]
WHERE $column[subid] = $subid AND
$column[subid] = 13 OR
$column[subid] = 14 OR
$column[subid] = 15 OR
$column[subid] = 16 OR
$column[subid] = 20 OR
$column[subid] = 21 AND
$column[pageactive] = 1 AND $column[parentpageid] = 0 AND
$column[pagedatetime] < '$now'
ORDER BY $column[pagedatetime] DESC", 1);
if(!$result2->EOF){
list($datetime)=$result2->fields;
setlocale (LC_TIME, pnConfigGetVar('locale'));
ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}) [0-9]{1,2}) [0-9]{1,2})", $datetime, $dt);
$dt = ml_ftime(""._LINKSDATESTRING."", mktime($dt[4],$dt[5],$dt[6],$dt[2],$dt[3],$dt[1]));
$dt = ucfirst($dt);
$startdate = time();
$count = 0;
while ($count <= 7) {
$daysold = ml_ftime(""._LINKSDATESTRING."", $startdate);
if ("$daysold" == "$dt") {
if ($count<=1)
$content .= "";
if ($count<=3 && $count>1)
$content .= "";
if ($count<=7 && $count>3)
$content .= "";
}
$count++;
$startdate = (time()-(86400 * $count));
}
}
$result2->Close();
$content .= "";
}
$result->MoveNext();
}
} else {
$content .= _SB_NOSUBJECTS;
}
$result->Close();
$content .= "";
if($pagesamount > 0){
if($row['position'] != 'c')
$content .= "";
$content .= "";
$now = date("Y-m-d H:i:00");
$column = &$pntable['subjects_column'];
$column2 = &$pntable['subpages_column'];
//// WHERE ...... 187 $column[subid] = 4 AND [ 4 Numero de la CATEGORIA ultimos_articulos Y ARTISTAS ] ////
$result = $dbconn->SelectLimit("SELECT $column[subid], $column[subname],
$column2[pageid], $column2[pagetitle],
$column2[pagetext], $column2[pagedatetime],
$column2[pagecounter]
FROM $pntable[subjects], $pntable[subpages]
WHERE $column[subid] = $column2[subid] AND
$column[subid] = 13 OR
$column[subid] = 14 OR
$column[subid] = 15 OR
$column[subid] = 16 OR
$column[subid] = 20 OR
$column[subid] = 21 AND
$column[subactive] = 1 $querylang AND
$column2[pageactive] = 1 AND $column2[parentpageid] = 0 AND
$column2[pagedatetime] < '$now'
ORDER BY $column2[pagedatetime] DESC", $pagesamount);
if (!$result->EOF) {
$content .= "";
while(list($subid, $subname, $pageid, $pagetitle, $pagetext, $pagedatetime, $pagecounter) = $result->fields) {
if (pnSecAuthAction(0, 'ultimos_articulos::Subjects', "$subname::$subid", ACCESS_READ)) {
setlocale (LC_TIME, pnConfigGetVar('locale'));
ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}) [0-9]{1,2}) [0-9]{1,2})", $pagedatetime, $datetime);
$datetime = ml_ftime(_DATEBRIEF, (GetUserTime(mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]))));
$datetime = ucfirst($datetime);
$content .= " | <img src=\"images/eye2.gif\"><a class=\"pn-normal\" href=\"modules.php?op=modload&name=Subjects&file=index&req=viewpage&pageid=$pageid\" title=\"$pagetitle\n$pagetext\">$pagetitle | ";
}
$result->MoveNext();
}
}
$result->Close();
$content .= "";
}
$content .= " ";
$row['content'] = $content;
return themesideblock($row);
}
function blocks_ultimos_articulos_add($row)
{
$row['url'] = 'Subjects|5|50|35|5';
return $row;
}
function blocks_ultimos_articulos_update($vars)
{
$vars['url'] = "$vars[mod]|$vars[pagesamount]|$vars[pagesdescription]|$vars[pagesshort]|$vars[reviewsamount]";
return $vars;
}
function blocks_ultimos_articulos_edit($row)
{
if (!empty($row['url'])) {
$url = explode('|', $row['url']);
$mod = $url[0];
$pagesamount = $url[1];
$pagesdesc = $url[2];
$pagesshort = $url[3];
$reviewsamount = $url[4];
} else {
$mod = 'Subjects';
$pagesamount = 5;
$pagesdesc = 0;
$pagesshort = 0;
$reviewsamount = 0;
}
$output = " | "
.""._SB_SUBJECTSMODNAME." | <input type=\"text\" name=\"mod\" size=\"10\" maxlength=\"255\" value=\"$mod\" class=\"pn-normal\"> "._SB_SUBJECTSMODINFO." | "
.""._SB_SUBPAGESAMOUNT." | <input type=\"text\" name=\"pagesamount\" size=\"3\" maxlength=\"3\" value=\"$pagesamount\" class=\"pn-normal\"> | "
.""._SB_SUBPAGEDESCRIPTION.": | "._SB_IFLONGER." <input type=\"text\" name=\"pagesdescription\" size=\"3\" maxlength=\"255\" value=\"$pagesdesc\"class=\"pn-normal\"> "._SB_CHARACTER." "._SB_SHORTENTO." "
."<input type=\"text\" name=\"pagesshort\" size=\"3\" maxlength=\"255\" value=\"$pagesshort\" class=\"pn-normal\"> "._SB_CHARACTER.". | "
.""._SB_REVIEWSAMOUNT." | <input type=\"text\" name=\"reviewsamount\" size=\"3\" maxlength=\"3\" value=\"$reviewsamount\" class=\"pn-normal\"> | "
." | \n" ;
return $output;
}
?>[/codigo]
http://www.Muscana.com | http://www.Proyect1.com
|
|
|
|
|
|
|
|
tollelle
|
|
|
Enviado: 22/12/2004 a las 17:12 |
|
Forero
Karma: 0 (1 Votos)
Registrado: 11/07/03
Mensajes: 109
Estado: Desconectado Ultima visita: 31/05/06 |
Alguien puede ayudarme con el bloque por favor?? :P
http://www.Muscana.com | http://www.Proyect1.com
|
|
|
|
|
|
|