Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Configurar un header con tpl

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Spanish
View previous topic :: View next topic  
Author Message
piropeator
Smarty Rookie


Joined: 31 Oct 2007
Posts: 26

PostPosted: Mon Jul 13, 2009 2:03 pm    Post subject: Configurar un header con tpl Reply with quote

Quisiera que me ayuden a configurar una cabecera utilizando smarty.
Ya he creado uno pero cuando cambio de nivel se pierde la imagen.
Les dejo el link para que puedan verlo.

http://www.sisbusiness.com/demo/demo.zip

Gracias. Laughing
Back to top
View user's profile Send private message
philoertel
Smarty Rookie


Joined: 25 Jun 2009
Posts: 14
Location: Chicago, IL

PostPosted: Tue Jul 14, 2009 3:11 pm    Post subject: Reply with quote

que tipo de header estas creando? http o html? si incluirias el codigo smarty de que hablas, podriamos entender el problema y responder.
_________________
Phil Oertel
Application Developer
http://www.soliantconsulting.com
Back to top
View user's profile Send private message AIM Address
piropeator
Smarty Rookie


Joined: 31 Oct 2007
Posts: 26

PostPosted: Wed Jul 15, 2009 10:57 pm    Post subject: Reply with quote

Aquí va el código:

index.php
======
<?php
require_once "./conf.php";
$tpl = new Plantilla();
$tpl->display('portada.tpl.php');
?>

Portadal.tpl
========
{include file="header.tpl.php"}
<table width="100%" border="1" cellspacing="1">
<tr>
<td colspan="2"><div align="center">PRINCIPALES PROCESOS </div></td>
</tr>
<tr>
<td width="50%"><a href="admin/proceso1.php">Proceso 1 </a></td>
<td width="50%">&nbsp;</td>
</tr>
<tr>
<td width="50%"><a href="admin/proceso2.php">Proceso 2 </a></td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="50%"><a href="admin/proceso3.php">Proceso 3 </a></td>
<td>&nbsp;</td>
</tr>
</table>
{include file="footer.tpl.php"}

header.tpl
=======
<table width="100%" border="1" cellspacing="0" bordercolor="#000066">
<tr>
<td width="50"><img src="./imagen/logos/logo.JPG" width="479" height="108" /></td>
<td width="52%">Espacio para noticias</td>
</tr>
</table>

Proceso1.php
=========
<?php
require_once ".../conf.php";
$tpl = new Plantilla();
$tpl->display('proceso1/proceso1.tpl.php');
?>

proceso1.tpl
========
{include file="header.tpl.php"}
<table width="100%" border="1" cellspacing="1">
<tr>
<td colspan="2"><div align="center">PROCESO 1 </div></td>
</tr>
<tr>
<td colspan="2"><div align="center"><a href="../index.php">Regresar</a></div></td>
</tr>
</table>
{include file="footer.tpl.php"}

Cuando corre proceso1.tpl ya no muestra la imagen.
Es así como debo crear una cabecera? o existe otra forma?
Gracias.
Back to top
View user's profile Send private message
philoertel
Smarty Rookie


Joined: 25 Jun 2009
Posts: 14
Location: Chicago, IL

PostPosted: Thu Jul 16, 2009 4:22 pm    Post subject: Reply with quote

a ver si entiendo. vas a http://tusitio/admin/proceso1.php, y se muestra la pagina, pero sin el contenido de header.tpl? y se ve el contenido de header.tpl en index.php? o es otra cosa?
_________________
Phil Oertel
Application Developer
http://www.soliantconsulting.com
Back to top
View user's profile Send private message AIM Address
piropeator
Smarty Rookie


Joined: 31 Oct 2007
Posts: 26

PostPosted: Sat Jul 18, 2009 3:21 pm    Post subject: Reply with quote

Así es. cuando carga el index.php lanza el portada.tpl y allí muestra el contenido del header que es el logo y un texto. Allí normal.
Cuando escoges la opción Proceso1.php esta se encuentra en una subcarpeta /admin (index está en la raiz), y lanza proceso1.tpl que están en una subcarpeta /proceso1 y también se utiliza el include header.tpl pero no muestra el logo, el texto si, no muestra el logo (la imagen).

Creo que faltaba colocar el contenido del archivo Conf.php que está en la raiz junto con index.php

Conf.php
======
<?php
define("APP_BASEDIR", dirname(__FILE__));
define('SMARTY_BASEFILE', APP_BASEDIR . '/lib/Smarty-2.6.14/Smarty.class.php');
define('ADODB_BASEFILE', APP_BASEDIR . '/lib/adodb-492/adodb.inc.php');
ini_set('session.gc_maxlifetime','1800'); // 30 minutos
ini_set('error_reporting', 'E_ALL');
require_once APP_BASEDIR . "/clases/util/Plantilla.class.php";
session_start();
?>

Espero haber sido claro con mi explicación y agradezco tu ayuda.
Smile
Back to top
View user's profile Send private message
philoertel
Smarty Rookie


Joined: 25 Jun 2009
Posts: 14
Location: Chicago, IL

PostPosted: Sat Jul 18, 2009 5:15 pm    Post subject: Reply with quote

oooooooh ok! aqui va tu problema:

el paso a la imagen es en header.tpl, y es relativo:

Code:
<td width="50"><img src="./imagen/logos/logo.JPG" width="479" height="108" /></td>


cuando el cliente pide http://tusitio/index.php, su browser ve "./imagen/logos/logo.JPG", y lo traduce en un URL relativo al documento: http://tusitio/imagen/logos/logo.JPG. y funciona como se expecta.

pero cuando el cliente pide http://tusitio/admin/proceso1.php, y el browser traduce el mismo paso relativo en un URL diferente, porque el documento es en otra locacion. esta vez es http://tusitio/admin/imagen/logos/logo.JPG. y esa imagen no existe.

la solucion es super facil: quita el punto del paso a la imagen. cambialo a paso absoluto: <img scr="/imagen/logos/logo.JPG">. y mira si no aparece la imagen correctamente en todos tus paginas :)
_________________
Phil Oertel
Application Developer
http://www.soliantconsulting.com
Back to top
View user's profile Send private message AIM Address
piropeator
Smarty Rookie


Joined: 31 Oct 2007
Posts: 26

PostPosted: Sun Jul 19, 2009 4:27 pm    Post subject: Reply with quote

Te cuento que al quitar ese punto, la imagen no aparece ni desde el index.php.
Sad
Tal vez es otra cosa.

No puedes acceder al link para bajarte el ZIP?
solo pesa 3 Mb. y no necesita base de datos : http://www.sisbusiness.com/demo/demo.zip

Espero puedas ayudarme.
Back to top
View user's profile Send private message
bandolera
Smarty n00b


Joined: 20 Aug 2009
Posts: 1

PostPosted: Wed Aug 26, 2009 1:33 pm    Post subject: Reply with quote

Hola revisé tu problema, aunque no pude acceder al link que pusiste, y debes poner la ruta desde tu raiz, mejor dicho utilizando el localhost o la ruta de tu sitio.
Porque si cambias de directorio todo tu sistema, no aparecerá la imagen.
Yo tenía un problema similar y ya lo solucioné.
Saludos.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: Spanish All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP