Menu

Common elements: p, div, span (and also article, aside, header, footer, section)

Simple container elements, like p, div, span, section, article &c., behave and are used in exactly the same way: you create an instance of the corresponding class, add content to it, set its properties, echo it directly or concatenate it with more elements or more text to be output later.

Each HTML5 element is represented by a class in go!Johnny. The class names consist in the prefix 'T' followed by the name of the element/tag you want. For example, if you want a paragraph (HTML p element), you have to use the TP class; for a span element, use the TSpan class and so on.

Note #1:
-Capitalisation is optional in class names. The go!Johnny convention is to use a capital T followed by the tag name, capitalising the first letter of each word. So, TBlockQuote for representing a blockquote element. However, you can perfectly write everything in lower case or in any combination you want: tblockquote, TBLOCKQUOTE &c, it makes no difference.

Note #2:
-In case you are wondering, I adopted the convention of the T prefix for naming classes because I was for some years a Delphi programmer. Even today I still do some things in Lazarus/FreePascal.

Let's see some examples:

<?php
$title = TH1('A Fairy Tale');
$intro = TP('Once upon a time...');
$story = TSection($title . $intro);
echo $story;

output:

<section id="story">
    <h1>
    A Fairy Tale
    </h1>
    <p id="intro">
    Once upon a time...
    </p>
</section>
Posted by panglossa 2013-04-08 Labels: div p paragraph span article section header footer common element TP TSpan TArticle TDiv TSection THeader TFooter TAside content items add add()

Log in to post a comment.