Foros del Web » Programando para Internet » PHP »

TCPDF Y Variables PHP

Estas en el tema de TCPDF Y Variables PHP en el foro de PHP en Foros del Web. Hola BUen Dia... Necesito de su ayuda he realizado un pdf con TCPDF , pero no encuentro la manera de ke me imprima variables de ...
  #1 (permalink)  
Antiguo 15/12/2010, 07:58
 
Fecha de Ingreso: febrero-2009
Mensajes: 47
Antigüedad: 15 años, 2 meses
Puntos: 2
TCPDF Y Variables PHP

Hola BUen Dia...
Necesito de su ayuda he realizado un pdf con TCPDF , pero no encuentro la manera de ke me imprima variables de php (consulta de base de datos, $_SESSION y demas).

Este es parte del codigo... Les agradeceria su ayuda.

$html .='<span class="encabezado_tabla4"><?php echo $_SESSION["fecha4"]; ?></span></div></td>
</tr>
</table></td>
<td width="420" ><br />
<br />
<table width="389" border="0" cellspacing="0">
<tr>
<td width="387"><table width="380" border="1" align="left" cellpadding="0" cellspacing="0" class="estilotabla">
<tr>
<td width="174" height="15"><div align="center" class="encabezado_tabla4">CONCEPTO</div></td>
<td width="200"><div align="center" class="encabezado_tabla4">VALOR</div></td>
</tr>
<tr>
<td class="textommPequeno" height="15">MATRICULA</td>
<td class="encabezado_tabla4"><div align="right">'.$registro["ordinaria"].'
</div></td>
</tr>
<tr>
<td height="15">&nbsp;</td>
<td class="encabezado_tabla4">$</td>
</tr>
<tr>
<td height="15">&nbsp;</td>
<td class="encabezado_tabla4">$</td>
</tr>
<tr>
<td height="15">&nbsp;</td>
<td class="encabezado_tabla4">$</td>
</tr>
<tr>
<td height="15">&nbsp;</td>
<td class="encabezado_tabla4">$</td>
</tr>
</table></td>
</tr>
<tr>
<td><p>&nbsp;</p>
<table width="380" border="1" align="left" cellpadding="0" cellspacing="0" class="estilotabla">
<tr>
<td width="114" height="15"><div align="center" class="encabezado_tabla4">MODALIDAD</div></td>
<td width="131"><div align="center" class="encabezado_tabla4">FECHA MAX. PAGO</div></td>
<td width="127"><div align="center" class="encabezado_tabla4">VALOR 1</div></td>
</tr>
<tr>
<td height="15" class="textommPequeno">FECHA 1</td>
<td class="textommPequeno"><div align="right">
&nbsp;<?php $dia = substr($registro["fecha1"],0,2); $mes = substr($registro["fecha1"],2,2); $anio = substr($registro["fecha1"],4,4); echo $anio.".".$mes.".".$dia; ?>
</div></td>
<td class="encabezado_tabla4"><div align="right">$
&nbsp;<?php if($_SESSION["institucion"]==2){$num=number_format($registro["ordinaria"] ,0 , "," ,"."); echo $num;}else{$num=number_format($registro["ordinaria1"] ,0 , "," ,"."); echo $num;} ?>
</div></td>
</tr>
<tr>
<td height="15" class="textommPequeno">FECHA 2</td>
<td class="textommPequeno"><div align="right">
&nbsp;<?php $dia = substr($registro["fecha2"],0,2); $mes = substr($registro["fecha2"],2,2); $anio = substr($registro["fecha2"],4,4); echo $anio.".".$mes.".".$dia; ?>
</div></td>
<td class="encabezado_tabla4"><div align="right">$
&nbsp; <?php if($_SESSION["institucion"]==2){$num=number_format($registro["ordinaria1"] ,0 , "," ,"."); echo $num;}else{$num=number_format($registro["ordinaria"] ,0 , "," ,"."); echo $num;} ?>
</div></td>
</tr>
<tr>
<td height="15" class="textommPequeno">FECHA 3</td>
<td class="textommPequeno"><div align="right">
&nbsp;<?php $dia = substr($registro["fecha3"],0,2); $mes = substr($registro["fecha3"],2,2); $anio = substr($registro["fecha3"],4,4); echo $anio.".".$mes.".".$dia; ?>
</div></td>
<td class="encabezado_tabla4"><div align="right">$
&nbsp;<?php $num=number_format($registro["extraordinaria"] ,0 , "," ,"."); echo $num; ?>
</div></td>
</tr>
<tr>
<td height="15" class="textommPequeno">FECHA 4 </td>
<td class="textommPequeno"><div align="right">
&nbsp;<?php $dia = substr($registro["fecha4"],0,2); $mes = substr($registro["fecha4"],2,2); $anio = substr($registro["fecha4"],4,4); echo $anio.".".$mes.".".$dia; ?>
</div></td>
<td class="encabezado_tabla4"><div align="right">$
&nbsp;<?php $num=number_format($registro["extraordinaria1"] ,0 , "," ,"."); echo $num; ?>
</div></td>
</tr>
<tr>
<td colspan="3" height="25" class="textommPequeno">OBSERVACIONES: <?php echo $registro["observaciones"]; ?><br /></td>
</tr>
</table>&nbsp;</td>
</tr>
</table>


</td>
</tr>
</table>
<br><br>';
  #2 (permalink)  
Antiguo 15/12/2010, 08:09
 
Fecha de Ingreso: diciembre-2010
Ubicación: Bahía Blanca, Buenos Aires, Argentina
Mensajes: 40
Antigüedad: 13 años, 4 meses
Puntos: 1
Respuesta: TCPDF Y Variables PHP

Hola!
ya de entrada observando la primera línea:

$html .='<span class="encabezado_tabla4"><?php echo $_SESSION["fecha4"]; ?></span></div></td>

Ya estás dentro de php, así no es necesario <?php
además estás concatenando, no pongas el echo, sino directamente lo que querés concatenar
Y ojo con las comillas
Esa línea quedaría:

$html .="<span class='encabezado_tabla4'>".$_SESSION["fecha4"]."</span></div></td>
Y así cambias uno por uno

Espero que te ayude :)

Guada
  #3 (permalink)  
Antiguo 15/12/2010, 09:37
 
Fecha de Ingreso: febrero-2009
Mensajes: 47
Antigüedad: 15 años, 2 meses
Puntos: 2
Respuesta: TCPDF Y Variables PHP

Hola si sabes asi si emprime las variables pero no donde corresponde... el diseño se daña.
  #4 (permalink)  
Antiguo 15/12/2010, 09:42
 
Fecha de Ingreso: diciembre-2010
Ubicación: Bahía Blanca, Buenos Aires, Argentina
Mensajes: 40
Antigüedad: 13 años, 4 meses
Puntos: 1
Respuesta: TCPDF Y Variables PHP

El diseño?
a ver, me mostrás la web? :)
  #5 (permalink)  
Antiguo 15/12/2010, 10:03
 
Fecha de Ingreso: febrero-2009
Mensajes: 47
Antigüedad: 15 años, 2 meses
Puntos: 2
Respuesta: TCPDF Y Variables PHP

http://www.virtualumb.com/descargas/prueba_pdf.pdf ... ahi veras las fechas sobre los codebars y es en la colmuna segunda de la segunda tabla.. te agradezco mucho tu ayuda por ke ando desesperada con esto.
  #6 (permalink)  
Antiguo 15/03/2012, 09:47
Avatar de osmalose  
Fecha de Ingreso: marzo-2012
Ubicación: ibagué
Mensajes: 3
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: TCPDF Y Variables PHP

al iniciar la concatenacion con la variable $html no es necesario q inicies con $html .=

Etiquetas: tcpdf, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:27.