conectar(); // instanciar los 0bjetos $tabla_noticia=new Tabla_Noticia($dataBase->getEnlaceHost()); $tabla_texto=new Tabla_Texto($dataBase->getEnlaceHost()); $tabla_producto=new Tabla_Producto($dataBase->getEnlaceHost()); $tabla_productofamilia=new Tabla_Productofamilia($dataBase->getEnlaceHost()); $tabla_productofoto=new Tabla_Productofoto($dataBase->getEnlaceHost()); $noticia=new Noticia(); $plantillas = array("plantillas/index.htm","plantillas/cabecera.htm","plantillas/lateral.htm","plantillas/pie.htm"); $plantilla = plantillas($plantillas); //para las noticias $lista_elementos=$tabla_noticia->obtenerListaNoticiasPortada(); $indice=0; $cuantos=$lista_elementos->getUltimo(); $plantillaFilaGenerica=leerFichero(RAIZ."/plantillas/noticias/fila.htm"); while ($indice<$cuantos){ $noticia=$lista_elementos->siguiente(); $plantillaFila=$plantillaFilaGenerica; $plantillaFila=str_replace(TAG_Nnoticia_VALUE,$noticia->getNnoticia(),$plantillaFila); $plantillaFila=str_replace(TAG_Tnot_en_VALUE,$noticia->getTnot_en(),$plantillaFila); $plantillaFila=str_replace(TAG_Tnot_es_VALUE,$noticia->getTnot_es(),$plantillaFila); $plantillaFila=str_replace(TAG_Tnot_fr_VALUE,$noticia->getTnot_fr(),$plantillaFila); $plantillaFila=str_replace(TAG_Tnot_jp_VALUE,$noticia->getTnot_jp(),$plantillaFila); $plantillaFila=str_replace(TAG_Ment_en_VALUE,$noticia->getMent_en(),$plantillaFila); $plantillaFila=str_replace(TAG_Ment_es_VALUE,$noticia->getMent_es(),$plantillaFila); $plantillaFila=str_replace(TAG_Ment_fr_VALUE,$noticia->getMent_fr(),$plantillaFila); $plantillaFila=str_replace(TAG_Ment_jp_VALUE,$noticia->getMent_jp(),$plantillaFila); $plantillaFila=str_replace(TAG_Falta_VALUE,fechaIdioma($noticia->getFalta()),$plantillaFila); $plantillaFilasCompleta.=$plantillaFila; $indice++; } $plantilla = ereg_replace("(.*)",$plantillaFilasCompleta, $plantilla); //para el texto $lista_textos=$tabla_texto->obtenerListaTextosPortada(); for($i=0;$i<$lista_textos->getUltimo();$i++){ $texto=$lista_textos->siguiente(); $txtPortadaEn.=$texto->getMtex_en(); $txtPortadaEs.=$texto->getMtex_es(); $txtPortadaFr.=$texto->getMtex_fr(); $txtPortadaJp.=$texto->getMtex_jp(); } $plantilla=str_replace("TAG_Mtex_en_VALUE",$txtPortadaEn,$plantilla); $plantilla=str_replace("TAG_Mtex_es_VALUE",$txtPortadaEs,$plantilla); $plantilla=str_replace("TAG_Mtex_fr_VALUE",$txtPortadaFr,$plantilla); $plantilla=str_replace("TAG_Mtex_jp_VALUE",$txtPortadaJp,$plantilla); //para el producto $producto=$tabla_producto->obtenerPortada(); $plantilla=str_replace("TAG_Nproduct_VALUE",$producto->getNproduct(),$plantilla); $plantilla=str_replace("TAG_Tpro_en_VALUE",$producto->getTpro_en(),$plantilla); $plantilla=str_replace("TAG_Tpro_es_VALUE",$producto->getTpro_es(),$plantilla); $plantilla=str_replace("TAG_Tpro_fr_VALUE",$producto->getTpro_fr(),$plantilla); $plantilla=str_replace("TAG_Tpro_jp_VALUE",$producto->getTpro_jp(),$plantilla); $productofamilia=new Productofamilia(); if ($tabla_productofamilia->existe($producto->getNfamilia())) $productofamilia=$tabla_productofamilia->obtener($producto->getNfamilia()); $plantilla=str_replace("TAG_Tfam_en_VALUE",$productofamilia->getTfam_en(),$plantilla); $plantilla=str_replace("TAG_Tfam_es_VALUE",$productofamilia->getTfam_es(),$plantilla); $plantilla=str_replace("TAG_Tfam_fr_VALUE",$productofamilia->getTfam_fr(),$plantilla); $plantilla=str_replace("TAG_Tfam_jp_VALUE",$productofamilia->getTfam_jp(),$plantilla); //para la foto principal $fotoprincipal=$tabla_productofoto->obtenerPrimero($producto->getNproduct()); if ($fotoprincipal->getNdestaca()==1){ $plantilla=str_replace(TAG_Nfoto_VALUE,$fotoprincipal->getNfoto(),$plantilla); $plantilla=str_replace(TAG_Tfoto_VALUE,$fotoprincipal->getTfoto(),$plantilla); $plantilla=str_replace(TAG_Talt_en_VALUE,$fotoprincipal->getTalt_en(),$plantilla); $plantilla=str_replace(TAG_Talt_es_VALUE,$fotoprincipal->getTalt_es(),$plantilla); $plantilla=str_replace(TAG_Talt_fr_VALUE,$fotoprincipal->getTalt_fr(),$plantilla); $plantilla=str_replace(TAG_Talt_jp_VALUE,$fotoprincipal->getTalt_jp(),$plantilla); $plantilla=str_replace(TAG_Mvid_es_VALUE,$fotoprincipal->getMvid_es(),$plantilla); $plantilla=str_replace(TAG_Mvid_en_VALUE,$fotoprincipal->getMvid_en(),$plantilla); $plantilla=str_replace(TAG_Mvid_fr_VALUE,$fotoprincipal->getMvid_fr(),$plantilla); $plantilla=str_replace(TAG_Mvid_jp_VALUE,$fotoprincipal->getMvid_jp(),$plantilla); if ($fotoprincipal->getTfoto()=="") $plantilla=ereg_replace("(.*)","",$plantilla); if ($fotoprincipal->getMvid_en()=="") $plantilla=ereg_replace("(.*)","",$plantilla); if ($fotoprincipal->getMvid_es()=="") $plantilla=ereg_replace("(.*)","",$plantilla); if ($fotoprincipal->getMvid_fr()=="") $plantilla=ereg_replace("(.*)","",$plantilla); if ($fotoprincipal->getMvid_jp()=="") $plantilla=ereg_replace("(.*)","",$plantilla); } else{ $plantilla=ereg_replace("(.*)","",$plantilla); $plantilla=ereg_replace("(.*)","",$plantilla); $plantilla=ereg_replace("(.*)","",$plantilla); $plantilla=ereg_replace("(.*)","",$plantilla); $plantilla=ereg_replace("(.*)","",$plantilla); } if ($producto->getNproduct()=="") $plantilla = ereg_replace("(.*)","", $plantilla); $error=array( 'TAG_Tnombre' => array (1,$Tnombre,"","","",""), 'TAG_Temail' => array (1,$Temail,"","","","") ); while (list($key,$value)=each($error)){ $plantilla=str_replace($key."_CHECKED".$value[1],"checked",$plantilla); $plantilla=str_replace($key."_VALUE",$value[1],$plantilla); if (!$value[0]) { $plantilla=str_replace($key,"error",$plantilla); } else { $plantilla=str_replace($key,"ok",$plantilla); } } echo $plantilla; ?>