Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/03/2017, 13:33
Avatar de Triby
Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: Mostrar mucho código HTML en PHP

El primer método es útil y legible si solo vas a mostrar HTML; la segunda opción es más adecuada si necesitas incluir variables en ese HTML.

Ejemplos:
Código PHP:
Ver original
  1. <?php
  2. $title = "Título de la página";
  3. $path = "./scripts";
  4. ?>
  5. <html>
  6. <title><?php echo $title; ?></title>
  7. <script src="<?php echo $path; ?>/script.js"></script>
  8. <?php
  9.     //open it back. here is your PHP again. easy!
  10. }

Código PHP:
Ver original
  1. <?php
  2. $title = "Título de la página";
  3. $path = "./scripts";
  4. echo <<<EOT
  5. <title>$title</title>
  6. <script src="$path/script.js"></script>
  7. EOT;
__________________
- León, Guanajuato
- GV-Foto