Your Opinion on Syntax Please

CodeIgniter has a Helper Library which may be of interest:

http://www.codeigniter.com/user_guide/helpers/html_helper.html

Nicked from their Library

Additionally, an associative array can be passed to the link() function for complete control over all attributes and values:

$link = array(
        'href'  => 'css/printer.css',
        'rel'   => 'stylesheet',
        'type'  => 'text/css',
        'media' => 'print'
);

echo link_tag($link);
// <link href="http://site.com/css/printer.css" rel="stylesheet" type="text/css" media="print" />

The library also includes helpers for doctype, img, heading, link_tag, ul, ol, br, nbs. The two latter items are soon to be deprecated by PHP str_repeat(
).

1 Like

With regards to inline elements, I am drifting towards the ability to append inline text and elements to the previous block level element. It seems a bit odd at first but I actually think it helps in easily distinguishing between text and elements, and oddly allows your eye to browse the text more easily despite it being broken up. This is particularly apparent for elements that have lots of attributes making them quite long.

p("footer")->p('Where\'s My Shoe?');
    a()->t(' Oh there it is, I can see it at ');
    a()->a('Daves house', ['href'=>'daves.html']);
    a()->t('. I am ');
    a()->strong('so');
    a()->t(' pleased to have found it');

What do you think?

Yeah, that is a problem. But I think I’ve solved it. Now you can pass anonymous function that will return list of children elements instead of specifiyng them directly. Example:

<?php
require('t.php');

$fruits = ['Apple', 'Orange', 'Banana', 'Strawberry'];

$t = new T();
$t->create(
    $t->html(['lang'=>'en-GB'], [
        $t->head([
            $t->title("Example page"),            
            $t->meta(['charset'=>'utf-8'])
        ]),
        $t->body([
            $t->article([
                $t->h1("List of fruits"),
                $t->ul(function() use ($t, $fruits){
                    foreach($fruits as $fruit){
                        $li[] = $t->li($fruit);
                    }
                    return $li;
                }),
            ]),
        ])
    ])
);

echo $t->dump();

Still quite readable and you don’t have to break your “flow” anymore.
Output HTML:

<html lang="en-GB">
    <head>
        <title>Example page</title>
        <meta charset="utf-8">
    </head>
    <body>
        <article>
            <h1>List of fruits</h1>
            <ul>
                <li>Apple</li>
                <li>Orange</li>
                <li>Banana</li>
                <li>Strawberry</li>
            </ul>
        </article>
    </body>
</html>

Modified class, if someone cares: http://pastebin.com/7EZJgWCk

That’s right, but that always happens when you edit big HTML doc or PHP script. Because indentation extremely helpful in reading. Look at your own piece of code:

for ($i=1; $i<=25; $i+=1) {
    $countExample .= $i;
    if ($i != 25) {
        $countExample .= ', ';
    }
}

You’ve used two levels of indentation here. Can you answer why? The same reason, I guess. What happens when your PHP-logic forces you to use lots of nested loops and IF’s? Doesn’t your code become horizontally wide? Sure it does. That’s the moment when you start to divide your code in separate blocks (functions). So why the same approach can’t be applied in your HTML-generation?

1 Like

That’s a nice solution.

I still think that the ‘atomic lines’ are easier to read and simpler though. That’s just my opinion though, it would be good to hear what other people think, it they prefer one approach to another and by how much.

It’s not indentation it’s self that is an issue, it is when indentation becomes significantly large, especially when the content of that line is long. My approach is to try and tame it, break it down into as simple chunks as possible while maintaining a linear readable flow. The markup scales better with the size of the document you are creating.

I think the problem in separating html into blocks is that the html is the output and it is essentially a structure. So when you split it up into blocks then you start to loose perspective of the overall structure. This usually isn’t a huge problem but I think being able to structure the code in a logical linear manor makes it much easier to ‘get’ what is going on, especially if you inherit code from someone else or haven’t looked at it in a long time.

Am I making sense?

You can say the same thing about PHP code, can’t you? Because PHP program also runs line by line and it is also a structure. But nobody will blame you if you divide that code into separated blocks. It can stay readable anyway. If you look at any modern PHP templating library (like Smarty) you’ll see there is always implemented great support of templates nesting.

It’s easier when there is not many code. Try to write all the code required to generate big real HTML page with that “flat” approach. You’ll see how complicated it looks.

Uhm, not to rain on the parade, but why reinvent the wheel?? http://php.net/manual/en/class.tidy.php

Or use SimpleXML to build this out as XHTML.

1 Like

We’re just making some mind exercises here :slight_smile:

That is really cool. I will most likely integrate it. The framework I am building does a few additional things too though which help with security for example.

I think it will look less complicated with lots of code. I will do an experiment tomorrow to see.

I don’t think you can compare PHP code with HTML. HTML is markup, and the markup you output influences the behaviour of the page. I think when you are programming to build it, you should be able to scan over the code and see how the html is formed. When dealing with indentation for the HTML and with the indentation for the PHP in the same file, I think it can look quite messy and confusing. It is better to remove the html indentation to being clarity to what is going on, in my opinion.

Absolutely
no way. Indentation is massively important to indicate where a block starts and ends, in any computer language. To me, a big block of code is terribly hard to read. In fact, there are routines out there that make big blocks of code (ok, they also get rid of lines) called “uglify”. LOL! :smiley:

Have you ever worked with a decent templating system? They most certainly always allow a breakup of the HTML into different smaller blocks in different files too. And this feature is always used, so the code is reusable. For instance, you practically always see a header and footer template in any application using templates. I’ve worked with systems, which even have an option to insert the template names, as HTML comments in the page output, so the search to find a spot to change is much easier.

You also realize, you are totally alienating designers/ front-end web developers with this idea?

I still don’t get the value. As mental exercise, fine. But as a useful tool? Like Michael, I’d like to suggest some form of DOM manipulation in PHP, to achieve the goals you want to achieve. Something like pquery might be of interest toward your goals, possibly, except for the readability bit, which simply isn’t going to happen in general. Large HTML pages are hard to read, as they aren’t built for humans to read, but rather for machines. And a large file of PHP representing HTML will be even harder to read.

Scott

1 Like

I totally agree indentation is vital in a html file. I am looking to preserve that. I am simply talking about how it is written server side. When writing a PHP file, I think the nuclear line idea I am proposing will make the code easier to read. You remove indentation in of the HTML in the PHP file using instead the parent name string. When the PHP returns the HTML as a string, it will be formed in an indented readable form in development mode, or one big ugly block in production (to reduce file size, but also optional).

Today I will turn a big-ish html file into the syntax I have produces, also the syntax @megazoid has come up with, and the raw html. I will post the three code sets here so we can see the difference.

You may well be right, in which case I will have gained a valuable change in opinion. But I feel reasonably confident that my syntax will be more readable.

Thanks for everyone’s input so far, that is why I started the thread. I want to discuss these ideas to lay bare any merits of flaws.

RT_ :slight_smile:

The same reasons why you indent HTML are why you indent PHP or Java or Python or Ruby or JS or 
hopefully you are getting the point now.

It is common practice and knowledge.

Scott

I’m not sure if you are being intentionally condescending, or just the way I’m reading it.

It is healthy to challenge convention. If no-one ever did we wouldn’t make any progress.

RT, take a look at how Drupal, particularly Drupal 8 though it’s in beta, deals with this situation. It uses Twig for the final setup of HTML, but form and page elements and placed into render arrays to delay their parsing into HTML until the last possible moment to make it easy for blocks and modules to modify the output of the page.

1 Like

Sorry, I don’t mean to sound condescending, but we aren’t talking about convention here. We are talking more like something that is common sense (and not just common practice and knowledge). Code is indented for readability. Not indenting code makes it less readable. It isn’t a convention you really need to question. Doing that is like when you know when a speeding car hits a concrete wall, it will be demolished. And because you do know that, you don’t have to drive another one into a wall to test the clear conclusion.

Scott

1 Like

Well, I agree not indenting code makes it not very readable, and that is well known. But I also think when you have two languages in a single file, HTML and PHP, maintaining the indentation for both can often lead to confusing and difficult to read code. What I am trying to propose is if there is a way to flatten just the html indentation in a php file, while maintaining the indentation of the PHP (the program logic) then it might make the file more readable, and building the HTML simpler. Another important point, is that I am only intending to flatten the indentation of the HTML in a physical sense, so not indented with tabs. But keeping it indented in a pseudo sense, a linear code flow with names to indicate how the elements are related to each other in a child, parent, sibling sense.

Apart from the syntax, the framework I am working on integrates with other tools I have written. To achieve that you simply have to form the html in a PHP structure, and @megazoid’s solution to the syntax would work just as well for that.

People have kindly supplied links to template frameworks which I am looking into. Template frameworks are the most popular solution and there is doubtlessly a good reason for that. However, this is an experiment to see if there is another way to build HTML that may be simpler, or a better solution for certain circumstances.

I hope I have explained a little more clearly now. I got the feeling I hadn’t explained what I meant clearly enough.

The solution within PHP itself is to use braceless syntax and avoid interlacing the html and PHP snippets as much as possible.

1 Like

Yeah, but I find braceless syntax can get quite messy too. IMHO

The html is based on this page Tim Berners Lee - BBC but I have shrunk it a little to be more practical for the forum.

Here is the html:

<!DOCTYPE html>
<html lang="en-GB">
    <head profile="http://dublincore.org/documents/dcq-html/">
        <title>
            BBC - History - Tim Berners Lee
        </title>
        <meta content="Discover facts about Tim Berners Lee the 20th century inventor of the World Wide Web." name="description">
        <meta content="history, internet, technology, world wide web, tim berners-lee, computer, scientist, cern" name="keywords">
        <link href="http://purl.org/dc/terms/" rel="schema.dcterms">
        <meta content="2006-09-05" name="dcterms.created">
        <meta content="2011-07-05" name="dcterms.modified">
        <link href="http://purl.org/dc/terms/" rel="schema.dcterms">
        <link href="http://www.bbc.co.uk/a-z/" rel="index" title="A to Z">
        <link href="http://www.bbc.co.uk/terms/" rel="copyright" title="Terms of Use">
        <link href="http://www.bbc.co.uk/favicon.ico" rel="icon" type="image/x-icon">
        <meta content="width = 974" name="viewport">
        <link href="/staticarchive/c808749ad4d537416e40591def8e05c130d72722.css" rel="stylesheet" type="text/css">
        <script src="http://node1.bbcimg.co.uk/glow/gloader.0.1.6.js" type="text/javascript"></script>
        <script src="/staticarchive/21f604032d29edfa0a166f89bd41c95004718ed2.js" type="text/javascript"></script>
    </head>
    <body class="blue biography">
        <div>
            <div id="prg-masthead">

                <p>
                    <a href="/history/" title="Go to the History homepage">History</a>
                </p>

                <div id="blq-local-nav">
                    <ul>
                        <li>
                            <a href="/history/ancient/" title="Go to the Ancient History section">Ancient History</a>
                        </li>

                        <li>
                            <a href="/history/british/" title="Go to the British History section">British History</a>
                        </li>

                        <li>
                            <a href="/history/worldwars/" title="Go to the World Wars section">World Wars</a>
                        </li>

                        <li class="stick">
                            <a href="/history/historic_figures/" title="Go to the Historic Figures section">Historic Figures</a>
                        </li>

                        <li>
                            <a href="/history/familyhistory/" title="Go to the Family History section">Family History</a>
                        </li>

                        <li>
                            <a href="/history/handsonhistory" title="Go to the Hands On History section">Hands on History</a>
                        </li>

                        <li>
                            <a href="/history/forkids" title="Go to the History for Kids section">History for Kids</a>
                        </li>

                        <li class="last">
                            <a href="/history/on_this_day/" title="Go to the On This Day section">On This Day</a>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="prg-wrapper" id="prg-wrapper-shell">
                <div id="blq-content">
                    <div id="prg-wrapper-featured">
                        <!-- START MAIN CONTENT AREA -->

                        <div class="a_z_container">
                            <h1>
                                Tim Berners Lee (1955 - )
                            </h1>

                            <div class="a_z_content">
                                <p>
                                    <span class="image_with_caption float_right" style="width:136px;"><img alt="Tim Berners Lee" height="185" src="/staticarchive/dbdaa3676c2f185821f774d3cf1ca4ea7e55bffb.jpg" width="136"> <span class="caption" style="width:126px;">Tim Berners Lee, at the Rayburn building on Capitol Hill in Washington, DC, 13 June 2001. <a href="/history/about/copyright.shtml">©</a></span></span> <em>Berners Lee is a British computer scientist who invented the World Wide Web.</em>
                                </p>

                                <p>
                                    Timothy John Berners Lee was born on 8 June 1955 and grew up in London. He studied physics at Oxford University and became a software engineer.
                                </p>

                                <p>
                                    In 1980, while working at CERN, the European Particle Physics Laboratory in Geneva, he first described the concept of a global system, based on the concept of 'hypertext', that would allow researchers anywhere to share information. He also built a prototype called 'Enquire'.
                                </p>

                                <p>
                                    In 1984, Berners Lee's returned to CERN, which was also home to a major European Internet node. In 1989, Berners Lee published a paper called 'Information Management: A Proposal' in which he married up hypertext with the Internet, to create a system for sharing and distributing information not just within a company, but globally. He named it the World Wide Web.
                                </p>

                                <p>
                                    He also created the first web browser and editor. The world's first website, http://info.cern.ch, was launched on 6 August 1991. It explained the World Wide Web concept and gave users an introduction to getting started with their own websites.
                                </p>

                                <p>
                                    In 1994, Berners Lee founded the World Wide Web Consortium at the Laboratory of Computer Science (LCS) at the Massachusetts Institute of Technology in Boston. He has served as director of the consortium since then. He also works as a senior research scientist at LCS which has now become the Computer Science and Artificial Intelligence Laboratory.
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>

I have changed my syntax slightly. It is different so initially you need to spend a minute looking at how it works, but I think it is nice and simple after getting used to it. For very indented documents I think it is easier to trace what block you are working on than with tab indentations.
b()
b() represents block level element, if it has a string argument then that means the element is the child of the last element with that tag name. It can also contain a second argument, a number, which means it is a child of the n’th last element with that tag name. If it is empty then it is a sibling of the last element. To easily see what element it is a child of, just scan upwards over the tag names (b()->tagName
) to find the first or n’th that you come across. The first b() is root.

i()
i() is for inline elements. after a block level element, you can call i() to add inline elements to that block. The first i() under a block element is root. itext() is a special inline element, because it is considered not as an element but just a block of text/string, it can’t have any children. Some inline elements can have children such as span. You can branch inline elements in the same way as block elements, and if you want to add an inline element to the root level you simply use i(‘root’)->yourInlineElement
 .

Here is my syntax representing this html:

<?php

b()->html(['lang'=>'en-GB']);
b('html')->head(['profile'=>'http://dublincore.org/documents/dcq-html/']);
b('head')->title('BBC - History - Tim Berners Lee');
b()->meta(['content'=>'Discover facts about Tim Berners Lee the 20th century inventor of the World Wide Web.','name'=>'description']);
b()->meta(['content'=>'history, internet, technology, world wide web, tim berners-lee, computer, scientist, cern'],'name'=>'keywords');
b()->link(['href'=>'http://purl.org/dc/terms/','rel'=>'schema.dcterms']);
b()->meta(['content'=>'2006-09-05','name'=>'dcterms.created']);
b()->meta(['content'=>'2011-07-05','name'=>'dcterms.modified']);
b()->link(['href'=>'http://purl.org/dc/terms/','rel'=>'schema.dcterms']);
b()->link(['href'=>'http://www.bbc.co.uk/a-z/','rel'=>'index','title'=>'A to Z']);
b()->link(['href'=>'http://www.bbc.co.uk/terms/','rel'=>'copyright','title'=>'Terms of Use']);
b()->link(['href'=>'http://www.bbc.co.uk/favicon.ico','rel'=>'icon','type'=>'image/x-icon']);
b()->meta(['content'=>'width = 974','name'=>'viewport']);
b()->link(['href'=>'/staticarchive/c808749ad4d537416e40591def8e05c130d72722.css','rel'=>'stylesheet','type'=>'text/css']);
b()->script(['src'=>'http://node1.bbcimg.co.uk/glow/gloader.0.1.6.js','type'=>'text/javascript']);
b()->script(['src'=>'/staticarchive/21f604032d29edfa0a166f89bd41c95004718ed2.js','type'=>'text/javascript']);
b('html')->body(['class'=>'blue biography']);
b('body')->div();
b('div')->div(['class'=>'blue biography']);
b('div')->p();
b('p')->a('History', ['href'=>'/history/','title'=>'Go to the History homepage']);
b('div')->div(['id'=>'blq-local-nav']);
b('div')->ul();
b('ul')->li();
b('li')->a('Ancient History',['href'=>'/history/ancient/', 'title'=>'Go to the Ancient History section']);
b('ul')->li();
b('li')->a('British History', ['href'=>'/history/british/', 'title'=>'Go to the British History section']);
b('ul')->li();
b('li')->a('World Wars', ['href'=>'/history/worldwars/', 'title'=>'Go to the World Wars section']);
b('ul')->li(['class'=>'stick']);
b('li')->a('Historic Figures', ['href'=>'/history/historic_figures/', 'title'=>'Go to the Historic Figures section']);
b('ul')->li();
b('li')->a('Family History', ['href'=>'/history/familyhistory/', 'title'=>'Go to the Family History section']);
b('ul')->li();
b('li')->a('Hands on History', ['href'=>'/history/handsonhistory', 'title'=>'Go to the Hands On History section']);
b('ul')->li();
b('li')->a('History for Kids', ['ref'=>'/history/forkids', 'title'=>'Go to the History for Kids section']);
b('ul')->li(['class'=>'last']);
b('li')->a('On This Day', ['href'=>'/history/on_this_day/', 'title'=>'Go to the On This Day section']);
b('body')->div(['class'=>'prg-wrapper', 'id'=>'prg-wrapper-shell']);
b('div')->div(['id'=>'blq-content']);
b('div')->div(['id'=>'prg-wrapper-featured']);
b('div')->div(['class'=>'a_z_container']);
b('div')->h1('Tim Berners Lee (1955 - )');
b()->div(['class'=>'a_z_content']);
b('div')->p();
    i()->span(['class'=>'image_with_caption float_right', 'style'=>'width:136px;']);
    i('span')->img(['alt'=>'Tim Berners Lee', 'height'=>'185', 'src'=>'/staticarchive/dbdaa3676c2f185821f774d3cf1ca4ea7e55bffb.jpg' 'width'=>'136']);
    i()->span('Tim Berners Lee, at the Rayburn building on Capitol Hill in Washington, DC, 13 June 2001.', ['class'=>'caption', 'style'=>'width:126px;']);
    i('span')->a('©',['href'=>'/history/about/copyright.shtml']);
    i('root')->em('Berners Lee is a British computer scientist who invented the World Wide Web.');
b()->p('Timothy John Berners Lee was born on 8 June 1955 and grew up in London. He studied physics at Oxford University and became a software engineer.');
b()->p('In 1980, while working at CERN, the European Particle Physics Laboratory in Geneva, he first described the concept of a global system, based on the concept of \'hypertext\', that would allow researchers anywhere to share information. He also built a prototype called \'Enquire\'.');
b()->p('In 1984, Berners Lee\'s returned to CERN, which was also home to a major European Internet node. In 1989, Berners Lee published a paper called \'Information Management: A Proposal\' in which he married up hypertext with the Internet, to create a system for sharing and distributing information not just within a company, but globally. He named it the World Wide Web.');
b()->p('He also created the first web browser and editor. The world\'s first website, http://info.cern.ch, was launched on 6 August 1991. It explained the World Wide Web concept and gave users an introduction to getting started with their own websites.');
b()->p('In 1994, Berners Lee founded the World Wide Web Consortium at the Laboratory of Computer Science (LCS) at the Massachusetts Institute of Technology in Boston. He has served as director of the consortium since then. He also works as a senior research scientist at LCS which has now become the Computer Science and Artificial Intelligence Laboratory.');

?>

Here is @megazoid’s syntax representing the html:

<?php

$t->html(['lang'=>'en-GB'], [
    $t->head([
        ['profile'=>'http://dublincore.org/documents/dcq-html/'], 
        $t->title('BBC - History - Tim Berners Lee'),
        $t->meta(['content'=>'Discover facts about Tim Berners Lee the 20th century inventor of the World Wide Web.','name'=>'description']),
        $t->meta(['content'=>'history, internet, technology, world wide web, tim berners-lee, computer, scientist, cern'],'name'=>'keywords'),
        $t->link(['href'=>'http://purl.org/dc/terms/','rel'=>'schema.dcterms']),
        $t->meta(['content'=>'2006-09-05','name'=>'dcterms.created']),
        $t->meta(['content'=>'2011-07-05','name'=>'dcterms.modified']),
        $t->link(['href'=>'http://purl.org/dc/terms/','rel'=>'schema.dcterms']),
        $t->link(['href'=>'http://www.bbc.co.uk/a-z/','rel'=>'index','title'=>'A to Z']),
        $t->link(['href'=>'http://www.bbc.co.uk/terms/','rel'=>'copyright','title'=>'Terms of Use']),
        $t->link(['href'=>'http://www.bbc.co.uk/favicon.ico','rel'=>'icon','type'=>'image/x-icon']),
        $t->meta(['content'=>'width = 974','name'=>'viewport']),
        $t->link(['href'=>'/staticarchive/c808749ad4d537416e40591def8e05c130d72722.css','rel'=>'stylesheet','type'=>'text/css']),
        $t->script(['src'=>'http://node1.bbcimg.co.uk/glow/gloader.0.1.6.js','type'=>'text/javascript']),
        $t->script(['src'=>'/staticarchive/21f604032d29edfa0a166f89bd41c95004718ed2.js','type'=>'text/javascript'])
    ]),
    $t->body(['class'=>'blue biography'],
        [$t->div([
            $t->div([
                ['class'=>'blue biography'],
                $t->p(
                    $t->a('History', ['href'=>'/history/','title'=>'Go to the History homepage'])
                ),
                $t->div([
                    ['id'=>'blq-local-nav'],
                    $t->ul([
                        $t->li(
                            $t->a([
                                'Ancient History',
                                ['href'=>'/history/ancient/', 'title'=>'Go to the Ancient History section']
                            ])
                        ),
                        $t->li(
                            $t->a([
                                'British History', 
                                ['href'=>'/history/british/', 'title'=>'Go to the British History section']
                            ])
                        ),
                        $t->li();
                            $t->a([
                                'World Wars', 
                                ['href'=>'/history/worldwars/', 'title'=>'Go to the World Wars section']
                            ])
                        ),
                        $t->li([
                            ['class'=>'stick'],
                            $t->a([
                                'Historic Figures', 
                                ['href'=>'/history/historic_figures/', 'title'=>'Go to the Historic Figures section']
                            ])
                        ]),
                        $t->li(
                            $t->a([
                                'Family History', 
                                ['href'=>'/history/familyhistory/', 'title'=>'Go to the Family History section']
                            ])
                        ),
                        $t->li(
                            $t->a([
                                'Hands on History', 
                                ['href'=>'/history/handsonhistory', 'title'=>'Go to the Hands On History section']
                            ])
                        ),
                        $t->li(
                            $t->a([
                                'History for Kids', 
                                ['ref'=>'/history/forkids', 'title'=>'Go to the History for Kids section']
                            ])
                        ),
                        $t->li([
                            ['class'=>'last'],
                            $t->a([
                                'On This Day', 
                                ['href'=>'/history/on_this_day/', 'title'=>'Go to the On This Day section']
                            ])
                        ])
                    ])
                ])
            ])
        ],
        [$t->div([
            'class'=>'prg-wrapper', 'id'=>'prg-wrapper-shell']
            $t->div([
                ['id'=>'blq-content'],
                $t->div([
                    ['id'=>'prg-wrapper-featured'],
                    $t->div([
                        ['class'=>'a_z_container'],
                        $t->h1('Tim Berners Lee (1955 - )'),
                        $t->div([
                            ['class'=>'a_z_content'],
                            $t->p([
                                $t->span([
                                    ['class'=>'image_with_caption float_right', 'style'=>'width:136px;'],
                                    $t->img(['alt'=>'Tim Berners Lee', 'height'=>'185', 'src'=>'/staticarchive/dbdaa3676c2f185821f774d3cf1ca4ea7e55bffb.jpg' 'width'=>'136']),
                                    $t->span([
                                        'Tim Berners Lee, at the Rayburn building on Capitol Hill in Washington, DC, 13 June 2001.', 
                                        ['class'=>'caption', 'style'=>'width:126px;'],
                                        $t->a([
                                            '©',
                                            ['href'=>'/history/about/copyright.shtml']
                                        ])
                                    ])
                                ]),
                                $t->em('Berners Lee is a British computer scientist who invented the World Wide Web.')
                            ]),
                            $t->p('Timothy John Berners Lee was born on 8 June 1955 and grew up in London. He studied physics at Oxford University and became a software engineer.'),
                            $t->p('In 1980, while working at CERN, the European Particle Physics Laboratory in Geneva, he first described the concept of a global system, based on the concept of \'hypertext\', that would allow researchers anywhere to share information. He also built a prototype called \'Enquire\'.'),
                            $t->p('In 1984, Berners Lee\'s returned to CERN, which was also home to a major European Internet node. In 1989, Berners Lee published a paper called \'Information Management: A Proposal\' in which he married up hypertext with the Internet, to create a system for sharing and distributing information not just within a company, but globally. He named it the World Wide Web.'),
                            $t->p('He also created the first web browser and editor. The world\'s first website, http://info.cern.ch, was launched on 6 August 1991. It explained the World Wide Web concept and gave users an introduction to getting started with their own websites.'),
                            $t->p('In 1994, Berners Lee founded the World Wide Web Consortium at the Laboratory of Computer Science (LCS) at the Massachusetts Institute of Technology in Boston. He has served as director of the consortium since then. He also works as a senior research scientist at LCS which has now become the Computer Science and Artificial Intelligence Laboratory.')
                        ])
                    ])
                ])
            ])
        ])
    ])
]);
?> 

Sorry, but, bleck


You’d be better off with a PHP jade interpreter (now wait, that isn’t a bad idea
)

In the meanwhile, it would be better to write your templates as conformant XHTML files, pull them into PHP using simpleXML and make further changes to that object then do this.

1 Like