Foros del Web » Programando para Internet » PHP »

php include

Estas en el tema de php include en el foro de PHP en Foros del Web. Hola, tengo un problemilla, me acabo de instala el appserver y en la carpeta de appserv/www tengo un index.php y un principal.php pero cuando lo ...
  #1 (permalink)  
Antiguo 20/06/2011, 03:48
 
Fecha de Ingreso: diciembre-2010
Mensajes: 459
Antigüedad: 13 años, 4 meses
Puntos: 21
php include

Hola, tengo un problemilla, me acabo de instala el appserver y en la carpeta de appserv/www tengo un index.php
y un principal.php pero cuando lo ejecuto me sale esto:
Por favor elija una categoría:
"; do_html_final(); ?>

El codigo de index.php

Código HTML:
Ver original
  1. <?php
  2.  include 'principal.php';
  3.  
  4.     do_html_cabezera();
  5.     echo "<p>Por favor elija una categoría:</p>";
  6.     do_html_final();
  7. ?>

El codigo de principal.php

Código HTML:
Ver original
  1. <?php
  2. function do_html_cabezera()
  3. {
  4. ?>
  5.   <html>
  6.   <head>
  7.     <title>PROBANDO</title>
  8.   </head>
  9.  
  10.   <body>
  11.   <table width=100% border=0 cellspacing = 0 bgcolor=#cccccc>
  12.   <tr>
  13.   <td rowspan = 2>
  14.     Nombre
  15.   </td>
  16.   <td align = right valign = bottom>
  17.     Correo
  18.   </td>
  19.   <td align = right rowspan = 2 width = 135>
  20.     Mensaje
  21.   </td>
  22.   </tr>
  23.   </table>
  24. }
  25.  
  26. <?php
  27. function do_html_final()
  28. {
  29. ?>
  30.   </body>
  31.   </html>
  32.  
  33. }

Alguna sugerencia?

Gracias
  #2 (permalink)  
Antiguo 20/06/2011, 04:45
Avatar de gonzalobarrerasaez  
Fecha de Ingreso: octubre-2010
Ubicación: Santiago, Chile
Mensajes: 6
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: php include

1 - La función do_cabecera no tiene un "echo" para mostrar el codigo HTML
2 - En tu archivo de funciones, te faltan los <?php } ?> en la última linea.

Salu2
  #3 (permalink)  
Antiguo 20/06/2011, 05:49
 
Fecha de Ingreso: diciembre-2010
Mensajes: 459
Antigüedad: 13 años, 4 meses
Puntos: 21
Respuesta: php include

Hola Gonzalo, he modificado de la siguiente forma

Código HTML:
Ver original
  1. <?php
  2. function do_html_cabezera()
  3. {
  4. echo "
  5.  <html>
  6.   <head>
  7.     <title>PROBANDO</title>
  8.   </head>
  9.  
  10.   <body>
  11.   <table>
  12.   <tr>
  13.   <td rowspan = 2>
  14.     Nombre
  15.   </td>
  16.   <td align = right valign = bottom>
  17.     Correo
  18.   </td>
  19.   <td align = right rowspan = 2 width = 135>
  20.     Mensaje
  21.   </td>
  22.   </tr>
  23.   </table>"
  24. }
  25.  
  26.  
  27. function do_html_final()
  28. {
  29.  
  30. echo "
  31.   </body>
  32.   </html>"
  33.  
  34. }
  35. ?>

Pero sigue saliendo lo mismo
  #4 (permalink)  
Antiguo 21/06/2011, 07:39
Avatar de gonzalobarrerasaez  
Fecha de Ingreso: octubre-2010
Ubicación: Santiago, Chile
Mensajes: 6
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: php include

Tienes habilitados los errores en un php?
según veo faltan las ";" al final de los echo
  #5 (permalink)  
Antiguo 21/06/2011, 11:37
 
Fecha de Ingreso: diciembre-2010
Mensajes: 459
Antigüedad: 13 años, 4 meses
Puntos: 21
Respuesta: php include

Uso el notepad++, he colocado los ;

de tal forma q queda

Código HTML:
Ver original
  1. <?php
  2. function do_html_cabezera()
  3. {
  4. echo "
  5.  <html>
  6.   <head>
  7.     <title>PROBANDO</title>
  8.   </head>
  9.  
  10.   <body>
  11.   <table>
  12.   <tr>
  13.   <td rowspan = 2>
  14.     Nombre
  15.   </td>
  16.   <td align = right valign = bottom>
  17.     Correo
  18.   </td>
  19.   <td align = right rowspan = 2 width = 135>
  20.     Mensaje
  21.   </td>
  22.   </tr>
  23.   </table>";
  24. }
  25.  
  26.  
  27. function do_html_final()
  28. {
  29.  
  30. echo "</body>
  31.   </html>";
  32.  
  33. }
  34. ?>

Pero sigue saliendo mal

Etiquetas: include
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 03:16.