function hotel($idHotel) { $mhotels = new MHotels(); $result = $mhotels->buscar_id($idHotel); foreach ($result['result'] as $r) { $nombreHotel = $r['nom_hotel']; $prov = $r['provincia']; $local = $r['localidad']; $calle = $r['calle']; $ncalle = $r['nro_calle']; $tel = $r['telefono']; $precio = $r['precio_persona']; $cant_imagenes = $r['cant_imagenes']; $descripcion = $r['descripcion']; } $tp = new TemplatePower("templates/hotel.html"); $tp->prepare(); $tp->gotoBlock("_ROOT"); $tp->assign("nombre", $nombreHotel); for ($i = 1; $i <= $cant_imagenes; $i++) { $tp->newBlock("imagenes"); $tp->assign("nombre", $nombreHotel); $tp->assign("numero", $i); } $tp->gotoBlock("_ROOT"); $tp->assign("descripcion", $descripcion); $tp->assign("prov", $prov); $tp->assign("local", $local); $tp->assign("calle", $calle); $tp->assign("ncalle", $ncalle); $tp->assign("tel", $tel); $tp->assign("precio", $precio); if (isset($_SESSION['user'])) { $tp->newBlock("reservar"); $tp->assign("idHotel", $idHotel); } if (!isset($_SESSION['user'])) { $tp->newBlock("iniciarSesion"); } echo $tp->getOutputContent(); }
<?php session_start(); include "inc.includes.php"; $db = new BaseDatos($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['db']); $tpl = new TemplatePower("templates/index.html"); $tpl->prepare(); $tpl->gotoBlock("_ROOT"); //isset determina si una variable esta definida o es null //$_REQUEST tiene el contenido de get y post if (!isset($_REQUEST["action"]) || $_REQUEST["action"] == "") { $tpl->newBlock("contenido"); $mhotels = new MHotels(); $result = $mhotels->allhoteles(); if ($result['found']) { foreach ($result['result'] as $r) { $tpl->newblock("hotels"); $tpl->assign("idHotel", $r['id_hotel']); $tpl->assign("name", $r['nom_hotel']); $tpl->assign("prov", $r['provincia']); $tpl->assign("local", $r['localidad']); $tpl->assign("calle", $r['calle']); $tpl->assign("ncalle", $r['nro_calle']); $tpl->assign("tel", $r['telefono']); $tpl->assign("precio", $r['precio_persona']); } } else { $tpl->newblock("no_hotels"); } $webapp = $tpl->getOutputContent(); } else {
public function datosbaja($id_hotel) { $tp = new TemplatePower("templates/BajaHotel.html"); $tp->prepare(); $tp->gotoBlock("_ROOT"); $tp->newBlock("hotelbaja"); $mhotels = new MHotels(); $result = $mhotels->buscar_id($id_hotel); foreach ($result['result'] as $r) { $nombreHotel = $r['nom_hotel']; $prov = $r['provincia']; $local = $r['localidad']; $calle = $r['calle']; $ncalle = $r['nro_calle']; $tel = $r['telefono']; $precio = $r['precio_persona']; $cant_imagenes = $r['cant_imagenes']; $descripcion = $r['descripcion']; } $tp->assign("nombre", $nombreHotel); $tp->assign("descripcion", $descripcion); $tp->assign("prov", $prov); $tp->assign("local", $local); $tp->assign("calle", $calle); $tp->assign("ncalle", $ncalle); $tp->assign("tel", $tel); $tp->assign("precio", $precio); $tp->assign("idHotel", $id_hotel); echo $tp->getOutputContent(); }