Foros del Web » Programando para Internet » PHP »

No muestra el HTML

Estas en el tema de No muestra el HTML en el foro de PHP en Foros del Web. la verdad no sé si esta consulta está bien planteada en este foro (php) lo que ocurre es que estoy trabajando con graficos, para ello ...
  #1 (permalink)  
Antiguo 08/09/2009, 14:18
 
Fecha de Ingreso: julio-2009
Ubicación: .mysql_error ( XD )
Mensajes: 554
Antigüedad: 14 años, 9 meses
Puntos: 13
No muestra el HTML

la verdad no sé si esta consulta está bien planteada en este foro (php)
lo que ocurre es que estoy trabajando con graficos, para ello uso la libreria ChartDirector y me funciona al 100. el problema es que me ignora todo codigo html, por lo cual el grafico lo muestra solo sin el CSS en un fondo blanco como es lo normal...

mi codigo es el siguiente

Código php:
Ver original
  1. <?php
  2. $anio = $_POST["ano"];
  3. if ($anio == "-- Año --")
  4. {
  5.     echo "<script>alert('Debes Seleccionar Un Año')</script>";
  6.     echo "<script>history.back()</script>";
  7. }
  8.  
  9. else
  10. {
  11.     include ("funciones.php");
  12.     conectar();
  13.    
  14.     $consulta = "Select * From total Where año='$anio' AND tipo='Capex'";
  15.     $resultado = mysql_query ($consulta);
  16.  
  17.     $i=0;
  18.     while ($registro = mysql_fetch_array($resultado))
  19.     {
  20.         $Categorias[$i] = $registro["categorias"];
  21.         $Enero[$i] = $registro["enero"];
  22.         $Febrero[$i] = $registro["febrero"];
  23.         $Marzo[$i] = $registro["marzo"];
  24.         $Abril[$i] = $registro["abril"];
  25.         $Mayo[$i] = $registro["mayo"];
  26.         $Junio[$i] = $registro["junio"];
  27.         $Julio[$i] = $registro["julio"];
  28.         $Agosto[$i] = $registro["agosto"];
  29.         $Septiembre[$i] = $registro["septiembre"];
  30.         $Octubre[$i] = $registro["octubre"];
  31.         $Noviembre[$i] = $registro["noviembre"];
  32.         $Diciembre[$i] = $registro["diciembre"];
  33.  
  34.         $i++;
  35.     }
  36.  
  37. include ("ChartDirector/lib/phpchartdir.php");
  38.  
  39. $colors = 0xFF9933;
  40.  
  41. $dato = array ("Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic");
  42.  
  43. $valor = array ("$Enero[0]", "$Febrero[0]", "$Marzo[0]", "$Abril[0]", "$Mayo[0]", "$Junio[0]", "$Julio[0]",
  44.                 "$Agosto[0]", "$Septiembre[0]", "$Octubre[0]", "$Noviembre[0]", "$Diciembre[0]");
  45.  
  46. # Create a XYChart object of size 600 x 380 pixels. Set background color to brushed
  47. # silver, with a 2 pixel 3D border. Use rounded corners of 20 pixels radius.
  48. $c = new XYChart(640, 400, brushedSilverColor(), Transparent, 5);
  49.  
  50. # Add a title to the chart using 18pts Times Bold Italic font.
  51. # Set top/bottom margins to 8 pixels.
  52. $textBoxObj = $c->addTitle("Capex Anual", "timesbi.ttf", 18);
  53. $textBoxObj->setMargin2(0, 0, 10, 10);
  54.  
  55. # Set the plotarea at (70, 55) and of size 460 x 280 pixels. Use transparent border
  56. # and black grid lines. Use rounded frame with radius of 20 pixels.
  57. $c->setPlotArea(70, 55, 460, 280, -1, -1, Transparent, 0x000000);
  58. $c->setRoundedFrame(0xffffff, 20);
  59.  
  60. # Add a multi-color bar chart layer using the supplied data. Set cylinder bar shape.
  61. $barLayerObj = $c->addBarLayer($valor, $colors);
  62. $barLayerObj->setBarShape(CircleShape);
  63.  
  64. # Set the labels on the x axis.
  65. $c->xAxis->setLabels($dato);
  66.  
  67. # Show the same scale on the left and right y-axes
  68. $c->syncYAxis();
  69.  
  70. # Set the left y-axis and right y-axis title using 10pt Arial Bold font
  71. $c->yAxis->setTitle("USD (millions)", "arialbd.ttf", 10);
  72. $c->yAxis2->setTitle("USD (millions)", "arialbd.ttf", 10);
  73.  
  74. # Set y-axes to transparent
  75. $c->yAxis->setColors(Transparent);
  76. $c->yAxis2->setColors(Transparent);
  77.  
  78. # Disable ticks on the x-axis by setting the tick color to transparent
  79. $c->xAxis->setTickColor(Transparent);
  80.  
  81. # Set the label styles of all axes to 8pt Arial Bold font
  82. $c->xAxis->setLabelStyle("arialbd.ttf", 8);
  83. $c->yAxis->setLabelStyle("arialbd.ttf", 8);
  84. $c->yAxis2->setLabelStyle("arialbd.ttf", 8);
  85.  
  86. # Output the chart
  87. header("Content-type: image/jpeg");
  88. echo($c->makeChart2(JPG));
  89. }
  90. ?>
  91.  
  92. <html>
  93. <head><title>Grafico</title>
  94.  
  95. <link rel="stylesheet" type="text/css" href="hojaestilo.css">
  96.  
  97. </head>
  98. <body>
  99.  
  100. <a href="capexAnual.php" class="letras1">Volver</a>
  101.  
  102. </body>
  103. </html>

y no muestra nada del <html> *** </html>
ni el enlace para volver ni la hoja de estilo CSS

esop... como puedo hacer para que no me ignore el html y muestre todo?
__________________
Mi Bosque de Sombras Solo Doom Metal!

por favor use esta etiqueta para publicar su código --->[HIGHLIGHT]
  #2 (permalink)  
Antiguo 08/09/2009, 17:05
 
Fecha de Ingreso: julio-2008
Mensajes: 91
Antigüedad: 15 años, 9 meses
Puntos: 6
Respuesta: No muestra el HTML

Supongo que debe ser que tu grafico de alguna manera borra o algo asi al codigo html.

Me parece que deberia ser asi:

Código php:
Ver original
  1. <?php
  2. // Todo tu codigo php .....
  3. ?>
  4. <html>
  5. <head>
  6. <title>Grafico</title>
  7. <link rel="stylesheet" type="text/css" href="hojaestilo.css">
  8. </head>
  9. <body>
  10.   <!-- La línea 88 de tu codigo php la trasladas dentro del body del html -->
  11.   <?php echo($c->makeChart2(JPG)); ?>
  12.   <a href="capexAnual.php" class="letras1">Volver</a>
  13. </body>
  14. </html>

Espero sea de tu ayuda.

Saludos...

Última edición por raul_romero; 08/09/2009 a las 17:06 Razón: Especificar línea de codigo....
  #3 (permalink)  
Antiguo 09/09/2009, 08:58
 
Fecha de Ingreso: julio-2009
Ubicación: .mysql_error ( XD )
Mensajes: 554
Antigüedad: 14 años, 9 meses
Puntos: 13
Respuesta: No muestra el HTML

gracias por responder pero también lo intente así y no me muestra la imagen del gráfico
no me está interpretando eso, si no que solo me muestra codigo inutil.

mira, te doy parte del fragmento de lo que muestra

Cita:
ÿØÿàJFIFÿÛC   %# , #&')*)-0-(0%()(ÿÛC   (((((((((((((((((((((((((((((((((((((((((((((( (((((ÿÀ€"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3 br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ× ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvw xyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓ ÔÕÖ×ØÙÚâãäåæçèéêòóôõö÷øùúÿÚ ?ú–yVËu=sTe•¤‘ʯ¢œZló•ä'å\¨ã k.[“+I Øsþx5¯ñcßgŸ¸Ÿ÷ÅgïöÏàiÁ¸û¿Ïü(Cu¡þÿ¾(Í¡þÿ¾k <œž™üÿ”}?h¢ÿv?ûäP·eþùŸ·' ü8Gèò4 >Î:*ß"ûDÿ¾EP8Xÿï“Kåzù_÷Á aÿcò ÅدåYþ_òËþø4áýrÿ¾ hªþTì¯÷“ô¬ñõ‡þø?ãOT>°ÿßühðp?‰i|ÅþúÕ%Cýè‡üÿ; Ë=äþù?ã@£:Ñç·U8ûÑß'üiL`ÿ_÷ˍ[óG÷ÿ(”ùÕAçïDà-þ4í‹ÿL¿ï“þ4gÌßýMñü_©ª»Ò?Àñ£bvþ_ýzµæïÖ—põ?­ TؽÂ~ÿ¯FÑÛoýóÿ× {þ÷ëA)ßwëTŠ.yÛùõé iê£ðÿëÐÜ¡þ÷ëFÑ¿Z¢bûËÿ|ñ E÷£ÿ¾øÐðý¯ÖŒ'|Õ-{2þ ?Æ€‹ýáÿ|ñ øOoΔ?þº¤0>òþCühÄyûëú]ÚŸäŠ §¿çTÆÏùè¿çñ¥%?ç²þýz·µGÿ®Œ'¨üêžcÿž«ùѽ?ç¬÷Õ[;=Wó¤Êz¥WŸóÒ/ûꜿÿÐÛ“Õ:PËýåüê%‘;4÷Ý;ÎߏþþP™SüKùŠC·Õ1L 3üqÿßÏþµ!{
XDDD


tambien intente haciendo en página separadas pasando los datos por una funcion, entre otras cosas, pero todo lo que hago me termina por mostrar lo mismo... una larga página con codigo que te acabo de mostrar!
__________________
Mi Bosque de Sombras Solo Doom Metal!

por favor use esta etiqueta para publicar su código --->[HIGHLIGHT]
  #4 (permalink)  
Antiguo 05/01/2010, 05:28
 
Fecha de Ingreso: junio-2009
Mensajes: 8
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: No muestra el HTML

Hola,
He consultado el foro porque tengo exactamente el mismo problema. Me dibuja el gráfico, pero me ignora el código html que añado posteriormente. Si en lugar de poner el código php del gráfico directamente en la página meto un include con otra página que contega dicho código, tampoco me muestra el html posterior. ¿Alguien me puede decir si hay alguna solución para esto? Muchas gracias.
Cervus


Cita:
Iniciado por Twonex Ver Mensaje
gracias por responder pero también lo intente así y no me muestra la imagen del gráfico
no me está interpretando eso, si no que solo me muestra codigo inutil.

mira, te doy parte del fragmento de lo que muestra



XDDD


tambien intente haciendo en página separadas pasando los datos por una funcion, entre otras cosas, pero todo lo que hago me termina por mostrar lo mismo... una larga página con codigo que te acabo de mostrar!
  #5 (permalink)  
Antiguo 05/01/2010, 07:08
 
Fecha de Ingreso: julio-2009
Ubicación: .mysql_error ( XD )
Mensajes: 554
Antigüedad: 14 años, 9 meses
Puntos: 13
Respuesta: No muestra el HTML

amigo... eso ya lo resolvi
lo que debes hacer es pasar los datos por variables a traves de un GET
en ese ejemplo yo usaba POST!!

te dejo acá el codigo de ese mismo ejemplo, pero bueno!


Código PHP:
Ver original
  1. <?php
  2. $anio = $_GET["ano"];
  3.  
  4. if ($anio == "-- Año --" )
  5. {
  6.     echo "<script>alert('Debes Seleccionar Un Año')</script>";
  7.     echo "<script>history.back()</script>";
  8. }
  9.  
  10. else
  11. {
  12.     include ("funciones.php"); //funcion que conecta a la BBDD
  13.     conectar();
  14.    
  15.     $consulta = "Select * From total Where año='$anio' AND tipo='Capex'";
  16.     $resultado = mysql_query ($consulta);
  17.  
  18.     $i=0;
  19.     while ($registro = mysql_fetch_array($resultado))
  20.     {
  21.         $Categorias[$i] = $registro["categorias"];
  22.         $Enero[$i] = $registro["enero"];
  23.         $Febrero[$i] = $registro["febrero"];
  24.         $Marzo[$i] = $registro["marzo"];
  25.         $Abril[$i] = $registro["abril"];
  26.         $Mayo[$i] = $registro["mayo"];
  27.         $Junio[$i] = $registro["junio"];
  28.         $Julio[$i] = $registro["julio"];
  29.         $Agosto[$i] = $registro["agosto"];
  30.         $Septiembre[$i] = $registro["septiembre"];
  31.         $Octubre[$i] = $registro["octubre"];
  32.         $Noviembre[$i] = $registro["noviembre"];
  33.         $Diciembre[$i] = $registro["diciembre"];
  34.  
  35.         $i++;
  36.     }
  37.  
  38. include ("ChartDirector/lib/phpchartdir.php");
  39.  
  40. $colors = 0xFF9933;
  41.  
  42. $dato = array ("Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic");
  43.  
  44. $valor = array ($Enero[0], $Febrero[0], $Marzo[0], $Abril[0], $Mayo[0], $Junio[0], $Julio[0],
  45.                 $Agosto[0], $Septiembre[0], $Octubre[0], $Noviembre[0], $Diciembre[0]);
  46.  
  47. # Create a XYChart object. Set background color to brushed
  48. # silver, with a 2 pixel 3D border. Use rounded corners of 20 pixels radius.
  49. $c = new XYChart(600, 380, brushedSilverColor(), Transparent, 5);
  50.  
  51. # Add a title to the chart using 18pts Times Bold Italic font.
  52. # Set top/bottom margins to 8 pixels.
  53. $textBoxObj = $c->addTitle("Capex Anual", "timesbi.ttf", 18);
  54. $textBoxObj->setMargin2(0, 0, 10, 10);
  55.  
  56. # Set the plotarea at (70, 55) and of size 460 x 280 pixels. Use transparent border
  57. # and black grid lines. Use rounded frame with radius of 20 pixels.
  58. $c->setPlotArea(70, 55, 460, 280, -1, -1, Transparent, 0x000000);
  59. $c->setRoundedFrame(0xffffff, 20);
  60.  
  61. # Add a multi-color bar chart layer using the supplied data. Set cylinder bar shape.
  62. $barLayerObj = $c->addBarLayer($valor, $colors);
  63. $barLayerObj->setBarShape(CircleShape);
  64.  
  65. # Set the labels on the x axis.
  66. $c->xAxis->setLabels($dato);
  67.  
  68. # Show the same scale on the left and right y-axes
  69. $c->syncYAxis();
  70.  
  71. # Set the left y-axis and right y-axis title using 10pt Arial Bold font
  72. $c->yAxis->setTitle("USD (millions)", "arialbd.ttf", 10);
  73. $c->yAxis2->setTitle("USD (millions)", "arialbd.ttf", 10);
  74.  
  75. # Set y-axes to transparent
  76. $c->yAxis->setColors(Transparent);
  77. $c->yAxis2->setColors(Transparent);
  78.  
  79. # Disable ticks on the x-axis by setting the tick color to transparent
  80. $c->xAxis->setTickColor(Transparent);
  81.  
  82. # Set the label styles of all axes to 8pt Arial Bold font
  83. $c->xAxis->setLabelStyle("arialbd.ttf", 8);
  84. $c->yAxis->setLabelStyle("arialbd.ttf", 8);
  85. $c->yAxis2->setLabelStyle("arialbd.ttf", 8);
  86.  
  87. }
  88.  
  89. //mostrar Grafico (imagen)
  90. header("Content-type: image/jpeg");
  91. echo($c->makeChart2(JPG));
  92.  
  93. ?>



y donde muestro el grafico es acá

Código PHP:
Ver original
  1. </head>
  2. <body>
  3. <?php
  4. $anio = $_POST["ano"];
  5. $url = 'grafico_CapexAnual.php?ano='.$anio;
  6. ?>
  7.  
  8. <img src="<?php echo $url ?>"> <br>
  9.  
  10. <form action="capexAnual.php" method="post">
  11.     <input type="submit" class="estilocelda3" value="Volver Atras">
  12. </form>
  13. </body>
  14. </html>



espero te sirva!
saludos
acepto karma :P
__________________
Mi Bosque de Sombras Solo Doom Metal!

por favor use esta etiqueta para publicar su código --->[HIGHLIGHT]
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 18:33.