View previous topic :: View next topic |
Author |
Message |
piropeator Smarty Rookie
Joined: 31 Oct 2007 Posts: 26
|
Posted: Mon Jul 13, 2009 2:03 pm Post subject: Configurar un header con tpl |
|
|
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. |
|
Back to top |
|
philoertel Smarty Rookie
Joined: 25 Jun 2009 Posts: 14 Location: Chicago, IL
|
Posted: Tue Jul 14, 2009 3:11 pm Post subject: |
|
|
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 |
|
piropeator Smarty Rookie
Joined: 31 Oct 2007 Posts: 26
|
Posted: Wed Jul 15, 2009 10:57 pm Post subject: |
|
|
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%"> </td>
</tr>
<tr>
<td width="50%"><a href="admin/proceso2.php">Proceso 2 </a></td>
<td> </td>
</tr>
<tr>
<td width="50%"><a href="admin/proceso3.php">Proceso 3 </a></td>
<td> </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 |
|
philoertel Smarty Rookie
Joined: 25 Jun 2009 Posts: 14 Location: Chicago, IL
|
|
Back to top |
|
piropeator Smarty Rookie
Joined: 31 Oct 2007 Posts: 26
|
Posted: Sat Jul 18, 2009 3:21 pm Post subject: |
|
|
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.
|
|
Back to top |
|
philoertel Smarty Rookie
Joined: 25 Jun 2009 Posts: 14 Location: Chicago, IL
|
Posted: Sat Jul 18, 2009 5:15 pm Post subject: |
|
|
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 |
|
piropeator Smarty Rookie
Joined: 31 Oct 2007 Posts: 26
|
Posted: Sun Jul 19, 2009 4:27 pm Post subject: |
|
|
Te cuento que al quitar ese punto, la imagen no aparece ni desde el index.php.
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 |
|
bandolera Smarty n00b
Joined: 20 Aug 2009 Posts: 1
|
Posted: Wed Aug 26, 2009 1:33 pm Post subject: |
|
|
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 |
|
|