Foros del Web » Programando para Internet » PHP »

nuevo problema con noktemplate

Estas en el tema de nuevo problema con noktemplate en el foro de PHP en Foros del Web. Hola amigos de fdw! He empezado a usar Noktemplate(muy bueno por cierto ) pero surgio un problema es que me repite el ultimo bloque 2 ...
  #1 (permalink)  
Antiguo 24/10/2003, 18:42
Avatar de sdf23  
Fecha de Ingreso: diciembre-2002
Mensajes: 297
Antigüedad: 21 años, 4 meses
Puntos: 0
nuevo problema con noktemplate

Hola amigos de fdw!

He empezado a usar Noktemplate(muy bueno por cierto )
pero surgio un problema es que me repite el ultimo bloque 2 veces ya intente la solucion de cluster y la misma que da nok ($html->expandir('ROWS','-fSites') y $html->asignar('ROWS',''); pero aun asi no funciona :
pongo el codigo:

index.php

Código PHP:
<?php  
include ('templates/Class.nok.php');  
include (
'config/config.php');
include 
'./templates/'.$config["theme"].'/lang/'.$config["idioma"].'.php';
$html = new NokTemplate('./templates/'.$config["theme"]);  

$html->cargar('tCuerpo','index.tpl.html');

$html->definirBloque('tNews''tCuerpo');
$html->definirBloque('fNews''tCuerpo');

$html->definirBloque('tSites''tCuerpo');
$html->definirBloque('fSites''tCuerpo');

/* Asignamos los nombres para los bloques */

$html->asignar('sitename'$config["sitename"]);   
$html->asignar('menuizq'$lang["menuizq"]);
$html->asignar('menuder'$lang["menuder"]);

$html->asignar('home'$lang["home"]);
$html->asignar('newsite'$lang["newsite"]);
$html->asignar('login'$lang["login"]);
$html->asignar('news'$lang["news"]);

/* Fin de nombres */

$news mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 1");

while(
$nrow mysql_fetch_array($news))
{
    
$noticia nl2br($nrow['noticia']);
    
$html->asignar('titulonoticia'$nrow['titulo']);    
    
$html->asignar('noticia'$noticia);       
    
$html->asignar('por',date("H:i:s"$nrow['fecha']));
    
    
$html->expandir('FILAS''+fNews');   
}  

$sites mysql_query("SELECT * FROM sites ORDER BY hitsout LIMIT 100");
$pos 1;
$html->expandir('ROWS','-fSites');
while(
$srow mysql_fetch_array($sites))
{
    
//$html->expandir('ROWS','-fSites');
    
if($pos <= 3)
        
$html->asignar('info''<a href="'.$srow['url'].'" target="_blank"><img src="'.$srow['banner'].'" border="0" alt="'.$srow['descripcion'].'"></a>');
    else
           
$html->asignar('info''');   
         
    
$html->asignar('pos'$pos);    
    
$html->asignar('uname'$srow['nombre']);       
    
$html->asignar('desc'$srow['descripcion']);
    
$html->asignar('hitsin'$srow['hitsin']);
    
$html->asignar('hitsout'$srow['hitsout']);
    
$html->asignar('url'$srow['url']);
    
    
$html->expandir('ROWS''+fSites');  
    
//$html->asignar('ROWS','');
    
$pos++;
}
//$html->asignar('ROWS','');

$html->expandir('CONTENIDO''tNews');  
$html->expandir('SITES''tSites');


$html->expandir('FINAL''tCuerpo');  

$html->imprimir('FINAL');  
?>
index.tpl.html:

error1:

<!-- inicioBloque: tNews -->
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" id="AutoNumber3">
{FILAS}
<!-- inicioBloque: fNews -->
<tr>
<td width="100%">{titulonoticia}</td>
</tr>
<tr>
<td width="100%">{noticia}</td>
</tr>
<tr>
<td width="100%">{fecha}</td>
</tr>
<!-- finBloque: fNews -->
</table>
<!-- finBloque: tNews -->

error2:

<!-- inicioBloque: tSites -->
<table width="80%" border="0" align="center">
{ROWS}
<!-- inicioBloque: fSites -->
<tr>
<td>{pos}.- {uname}</td>
</tr>
<tr>
<td><center>{info}</center><br><center>{desc}</center>
</td>
</tr>
<tr>
<td>In: {hitsin} Out: {hitsout}</td>
</tr>
<!-- finBloque: fSites -->
</table>
<!-- finBloque: tSites -->


ojala mepuedan ayudar
__________________

la vida es bella cuando no es culera

Última edición por sdf23; 24/10/2003 a las 18:44
  #2 (permalink)  
Antiguo 24/10/2003, 19:16
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
tu problema yo lo he tenido, siempre me repetia el ultimo registro, yo lo solucione, desmontando el trozo de script que lo producia,, te dejo como lo hago yo.

Código PHP:
<?php

if (!isset($_GET['accion'])){//inicio funcion menu dinamico

/////////////////////////////////////////////////////////////////////////////////
/*SACO EL NUMERO DE MENUS Y COMPRUEBO SI ESTA ONLINE O DESCONECTADO: INICIO*/

$totalMenusActivosDin mysql_num_rowsmysql_query("SELECT DISTINCT numero_menu FROM $sql_tabla_dat_menu WHERE orientacion_menu='0'") ) or die("MySQL dice: ".mysql_error());//saco el numero de menus activos

    
for ($cuentaBucleDin=1;$cuentaBucleDin<$totalMenusActivosDin+1;$cuentaBucleDin++) {//genero bucle

    
$consultMenuOnlineDin mysql_query("SELECT $selecttbl_dat_menu FROM $sql_tabla_dat_menu WHERE numero_menu='$cuentaBucleDin'") or die("MySQL dice: ".mysql_error());//saco si esta online o no el bloke

        
while($resultMenuOnlineDin mysql_fetch_array($consultMenuOnlineDin)) {

           
$onlineDinDato $resultMenuOnlineDin['mostrar_menu'];//transporte menu activo=1, desactivado=0

        
}//salgo del while_mysql_fetch_array


            
if ($onlineDinDato == "1") {//compruebo que este online el menu
            

/////////////////////////////////////////////////////////////////////////////////
                /*DESPLIEGO BLOKES CON LOS DATOS: INICIO*/

            
$html->expandir('mostrarLinkMenuDin''-filaGeneraMenuDinamico');//reseteo las filas de la tabla, para limpiar al volver con el for

    
$consulMenuDin mysql_query("SELECT $selecttbl_dat_menu FROM $sql_tabla_dat_menu WHERE mostrar_menu='1' AND numero_menu='$cuentaBucleDin' AND mostrar_dat='1' ORDER BY posicion_dat ASC") or die("MySQL dice: ".mysql_error());//busca los datos de cada menu y los ordena automaticamente

        
while($resulConsulMenuDin mysql_fetch_array($consulMenuDin)) {// sacamos los datos en un array

            
$html->asignar('textoTituloMenus',$resulConsulMenuDin['titulo_menu']);//asigno los valores: titulo menu
            
$html->asignar('tituloLinkDatMenu',$resulConsulMenuDin['titulo_dat']);//asigno los valores: titulo de los link de cada menu
            
$html->asignar('urlLinkDatMenu',$resulConsulMenuDin['url_dat']);//asigno los valores: transporte de la url
            
$html->asignar('targetLinkDatMenu',$resulConsulMenuDin['target_dat']);//asigno los valores: _self, _blank,...
            
$html->asignar('infoLinkDatMenu',$resulConsulMenuDin['info_dat']);//asigno los valores: descripcion de cada link


            
$html->expandir('mostrarLinkMenuDin''+filaGeneraMenuDinamico');//expando la filas de cada bloke


      
}//salimos del while
      
      
            
$html->expandir('muestraMenuDinamico''+bloqGeneraMenuDinamico'); //ATENCION: debo expandirlo en cada interaccion del bucle .. no al final (sino será la última), RECORDATORIO!!!

    
mysql_free_result($consulMenuDin);// limpiamos memoria

                /*DESPLIEGO BLOKES CON LOS DATOS: FIN*/
/////////////////////////////////////////////////////////////////////////////////


            
}//termino de generar menu


    
}//termino el for

    
mysql_free_result($consultMenuOnlineDin); //limpiamos memoria

/*SACO EL NUMERO DE MENUS Y COMPRUEBO SI ESTA ONLINE O DESCONECTADO: FIN*/

}//fin del menu dinamico



if ($_GET['accion']=="redireccion"){//submenu redireccion, cuando pulsan sobre un link

    
$id $_GET['id'];
        
$consultMenuUrl mysql_query("SELECT $selecttbl_dat_menu FROM $sql_tabla_dat_menu WHERE id='$id'") or die("MySQL dice: ".mysql_error());

            while(
$resultMenuUrl mysql_fetch_array($consultMenuUrl)) {
                
$resultMenuUrlName $resultMenuUrl['url_dat'];
            }

                
header ("Location: $result_menu_url_name");//pulsan boton y linko hacia es sistema <body>

        
mysql_free_result($consultMenuUrl);// limpiamos memoria
    
exit;
}
//terminamos submenu redireccion
?>
fichero *.tpl

Código PHP:
<!-- inicioBloquebloqGeneraMenuDinamico -->
<
div align="{div_align_menu}">
    <
table border="{max_menu_bloke_table_border}" width="{max_menu_bloke_table_width}">
        <
tr>
            <
th width="100%" height="15" align="{max_menu_bloke_aling_td}" bgcolor="{max_menu_bloke_td_bgcolor}" background="templates/images/barra_menu.gif"><b>{textoTituloMenus}</font><b></th>
        <
tr>
            <
td width="100%" height="2" bgcolor="{max_menu_bloke_td_bgcolor}" background="templates/images/barra_menu.gif"></td>
        </
tr>

{
mostrarLinkMenuDin}
<!-- 
inicioBloquefilaGeneraMenuDinamico -->
<
tr>
    <
td width="100%"><a href="{urlLinkDatMenu}" target="{targetLinkDatMenu}" title="{infoLinkDatMenu}" class="max_menu_url" class=&{max_menu};><img src="templates/images/db.gif" height="7" width="8" border="0"> {tituloLinkDatMenu}</a></td>
</
tr>
<!-- 
finBloquefilaGeneraMenuDinamico -->

        <
tr>
            <
td width="100%" height="2" bgcolor="{max_menu_bloke_td_bgcolor}" background="templates/images/barra_menu.gif"></td>
        </
tr>
        <
tr>
            <
td width="100%" height="6" bgcolor="{max_menu_bloke_td_bgcolor}" background="templates/images/barra_menu.gif"></td>
        </
tr>
    </
table>
</
div>
<
br>
<!-- 
finBloquebloqGeneraMenuDinamico --> 
__________________
3w.valenciadjs.com
3w.laislatv.com
  #3 (permalink)  
Antiguo 24/10/2003, 19:25
Avatar de sdf23  
Fecha de Ingreso: diciembre-2002
Mensajes: 297
Antigüedad: 21 años, 4 meses
Puntos: 0
haber ya lo intente asi y7 no furula mira como lo puse:

Código PHP:
$html->expandir('ROWS''-fSites');//
$sites mysql_query("SELECT * FROM sites ORDER BY hitsout LIMIT ".$start.",".$config["ver"]);
$pos 1;
while(
$srow mysql_fetch_array($sites))
{
    
//$html->expandir('ROWS','-fSites');
    
if($pos <= 3)
        
$html->asignar('info''<a href="'.$srow['url'].'" target="_blank"><img src="'.$srow['banner'].'" border="0" alt="'.$srow['descripcion'].'"></a>');
    else
           
$html->asignar('info''');   
         
    
$html->asignar('pos'$pos);    
    
$html->asignar('uname'$srow['nombre']);       
    
$html->asignar('desc'$srow['descripcion']);
    
$html->asignar('hitsin'$srow['hitsin']);
    
$html->asignar('hitsout'$srow['hitsout']);
    
$html->asignar('url'$srow['url']);
    
    
$html->expandir('ROWS''+fSites');  
    
//$html->asignar('ROWS','');
    
$pos++;

__________________

la vida es bella cuando no es culera
  #4 (permalink)  
Antiguo 24/10/2003, 19:27
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
creo que se te olvido EXPANDIR todo el bloke al final,,, como yo hago

$html->expandir('muestraMenuDinamico', '+bloqGeneraMenuDinamico');

en el html: {mostrarLinkMenuDin}
__________________
3w.valenciadjs.com
3w.laislatv.com
  #5 (permalink)  
Antiguo 24/10/2003, 19:50
Avatar de sdf23  
Fecha de Ingreso: diciembre-2002
Mensajes: 297
Antigüedad: 21 años, 4 meses
Puntos: 0
simas abajito lo hago:

$html->expandir('SITES', 'tSites');
__________________

la vida es bella cuando no es culera
  #6 (permalink)  
Antiguo 24/10/2003, 20:02
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
si esto es el bloke completo... no las filas, si no el bloke completo

$html->expandir('SITES', '+tSites');
__________________
3w.valenciadjs.com
3w.laislatv.com
  #7 (permalink)  
Antiguo 24/10/2003, 20:11
Avatar de sdf23  
Fecha de Ingreso: diciembre-2002
Mensajes: 297
Antigüedad: 21 años, 4 meses
Puntos: 0
si asi lo hago pero aun asi lo repite
__________________

la vida es bella cuando no es culera
  #8 (permalink)  
Antiguo 24/10/2003, 21:11
Avatar de nuevo  
Fecha de Ingreso: mayo-2003
Ubicación: Spain
Mensajes: 2.009
Antigüedad: 20 años, 11 meses
Puntos: 2
yo ante este problema, lo que haria es hacer un ejemplo simple y probarlo, sin usar bases de datos ni nada, y luego integrarlo en tu script
__________________
3w.valenciadjs.com
3w.laislatv.com
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:59.