-1

With some frameworks you can have a HTML page with PHP inside it without opening PHP.

Example:

<html>
    <body>
        <h1>{{title}}</h1>
        <hr />
        {{content}}
    </body>
</html>

So where the value between {{}} defines what needs to be displayed instead of opening and closing PHP every time you need something.

I assume that it is some version of HTML parsedown link, but I would appreciate it if somebody elaborated on this subject.

Tom
  • 606
  • 7
  • 28
  • 2
    You could use the [Twig Templating Engine](http://twig.sensiolabs.org/), it has similar markup. – ccKep Feb 28 '16 at 15:30
  • I am curious as to how it works, I want to recreate something like that, not use something that already exists. – Tom Feb 28 '16 at 15:37
  • There's no such thing that HTML content is filled without PHP running or whatever. PHP will run before HTML in any scenario. The only difference these frameworks might make is that they can have rules and hooks set up (eg when a client tries to access a html page, seek the script, run it, fill the html and then present it to the client) but that really isn't any different than just the `` method, it just looks prettier. – Cârnăciov Feb 28 '16 at 15:45
  • 1
    @Tom read the source code of Twig or perhaps something more lightweight as https://github.com/bobthecow/mustache.php and learn – Michael Feb 28 '16 at 16:56

1 Answers1

0

use shortcode to echo <?=$title;?>

It's not that much work compared to wrapping everything in {{}}

Josh S.
  • 612
  • 3
  • 8
  • Using short tags would work only work if `.html` files were set up to be treated as `.php` files on the webserver. – Gavin Feb 28 '16 at 15:35
  • It was never specified it was a .html extension. – Josh S. Feb 28 '16 at 15:37
  • "With some frameworks you can have a HTML page with PHP inside it..." – Gavin Feb 28 '16 at 15:38
  • You could say that with a .php extension. it's a HTML page with PHP inside of it lol. "without opening PHP" leads you to believe that he has the option to. – Josh S. Feb 28 '16 at 15:43
  • Wasnt after an argument. Just pointing out that short tags dont work in `.html` files if the server doesnt parse them as `php`. – Gavin Feb 28 '16 at 15:46
  • Either way, yes, multiple interpretations. Agreed that .html can be modified by the server to handle php. – Josh S. Feb 28 '16 at 15:51