Indenting with hTag()
This demonstrates indenting text with the htag() function. To see the output, use the view source command. For most browsers, you can do this by right clicking in the document and selecting "v"iew "s"ource.
You can view the PHP program for this page and htag() through my Source Code Viewer.
Notice: Use of undefined constant TAB - assumed 'TAB' in /var/www/php/htag.php on line 69
TABTAB
htag() is a very simple program.htag('tag'); will open a tag and increase indent level.htag('-tag'); will create a self closing tag, eg. a meta tag.htag('/tag'); will close a tag and decrease indent and drop a note in the HTML if there is a tag mismatch.
Notice: Use of undefined constant TAB - assumed 'TAB' in /var/www/php/htag.php on line 69
TABTAB
The second parameter is the text for the attribute section of the tag. I turned this paragraph blue with a style attribute in the tag.
Notice: Use of undefined constant TAB - assumed 'TAB' in /var/www/php/htag.php on line 69
TABTAB
The $contents parameter is for the contents between an open and close tage. When contents is not null (as it is for the paragraph I am writing), htag() will create a self closing tag. If $contents is an array, the program will enclose each section of the array in tags.
TABTABIn the next call, I will pass an array summarizing the last paragraphs.
TABTAB- htag('tag'); opens tag and indents next level. TABTABTAB
- htag('-tag'); creates a self closing tag. TABTABTAB
- htag('/tag'); closes a tag. TABTABTAB
- The attributes parameter sets the tags attributes. TABTABTAB
- If the call include contents; htag creates a self closing tag. TABTABTAB
- if the contents is an array, htag will enclose the array in tags. TABTAB
Notice: Use of undefined constant TAB - assumed 'TAB' in /var/www/php/htag.php on line 87
TABTABTAB
In this next example, I will produce a select list from a two dimensional array with the third element selected:
Notice: Use of undefined constant TAB - assumed 'TAB' in /var/www/php/htag.php on line 69
TABTAB
Notice: Use of undefined constant TAB - assumed 'TAB' in /var/www/php/htag.php on line 69
TAB