Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/01/2011, 04:26
maxtorplextor
 
Fecha de Ingreso: marzo-2008
Ubicación: España
Mensajes: 243
Antigüedad: 16 años, 2 meses
Puntos: 7
Insertar código php en .tpl

Hola,

Tengo un script en php el cual me gustaría insertar en el header.tpl del php weby directory y no lo consigo. He visto que se podría añadir un include (<p>{php}include("http://full path to/example.php");{/php} </p>) en tpl pero la programación no es lo mío y no sé cómo hacerlo. Además el script viene todo en el mismo archivo php.

El script es:
Código PHP:
Ver original
  1. <?php
  2. require("simplepie.inc");
  3. require("simplepie_yahoo_weather.inc");
  4.  
  5. $code = "ANXX0001";
  6. $path = "http://weather.yahooapis.com/forecastrss?u=c&p=";
  7. $feed = new SimplePie();
  8. $feed->set_feed_url($path.$code);
  9. $feed->set_item_class('SimplePie_Item_YWeather');
  10. $feed->init();
  11.  
  12. $weather = $feed->get_item(0);
  13. ?>
.....
.....
.....
Código PHP:
Ver original
  1. <table>
  2. <tr>
  3. <td><img src="<?php echo $weather->get_condition_image(); ?>" width="25" height="25" border="0" /></td>
  4. <td>Condiciones: <?php echo $weather->get_condition(); ?></td>
  5. <td>Temperatura: <?php echo $weather->get_temperature(); ?>&deg;<?php echo $weather->get_units_temp(); ?></td>
  6. <td>Humedad: <?php echo $weather->get_humidity(); ?>%</td>
  7. <td>Rising: <?php echo $weather->get_rising(); ?>%</td>
  8. <td>Amanecer: <?php echo $weather->get_sunrise(); ?></td>
  9. <td>Ocaso: <?php echo $weather->get_sunset(); ?></td>
  10. </tr></table>
.....
.....
.....

Podrían ayudarme para integrarlo en dicho header.tpl?

Gracias!

Última edición por maxtorplextor; 15/01/2011 a las 04:36