Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,20 @@ Old:
</html>
```

My function:
New:
```
<?php
html();
body('class="body"');
include_once("html_function.php");
h_html();
h_body('class="body"');
for($i=1;$i<=12;$i++)
show($i.' ');
body_end();
html_end();
h_print($i.' ');
h_body_end();
h_html_end();
?>
```
you can use function ```tag()``` for make html ```<tag>``` (tag is name of html tag)
and use ```tag_end()``` for close tag ,it like ```</tag>```
you can use function ```h_tag()``` for make html ```<tag>``` (tag is name of html tag)
and use ```h_tag_end()``` for close tag ,it like ```</tag>```

so name of tag that I have in my function is:
"div",
"html",
"body",
"head",
"table",
"th",
"tr",
"td",
"a",
"p",
"form",
"input"
Almost every tags but doctype (and not support in html5 ones)
30 changes: 15 additions & 15 deletions example.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
include "gen_function.php";
include "html_function.php";


$A = array("name","class","talk","detail");
Expand All @@ -16,26 +16,26 @@ function each_all($tag='',$arr=array())
}
}

html();
body();
show('table<br>');
table('border="1"');
h_html();
h_body();
h_print('table<br>');
h_table('border="1"');
foreach($A as $a)
{
th();
show($a);
th_end();
h_th();
h_print($a);
h_th_end();
}

tr();
h_tr();
each_all('td',$data_1);
tr_end();
h_tr_end();

tr();
h_tr();
each_all('td',$data_2);
tr_end();
h_tr_end();

table_end();
body_end();
html_end();
h_table_end();
h_body_end();
h_html_end();
?>
24 changes: 24 additions & 0 deletions html_function.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
$singleton = array("area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr");
$tags = array("a", "abbr", "address", "article", "aside", "audio", "b", "bdi", "bdo", "blockquote", "body", "button", "canvas", "caption", "cite", "code", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "html", "i", "iframe", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "span", "strong", "style", "sub", "summary", "sup", "svg", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "u", "ul", "var", "video");

function t_init($singleton, $tags){
foreach($singleton as $tag) t_start($tag);
foreach($tags as $tag){
t_start($tag);
t_stop($tag);
}
}

function t_start($tag){
eval('function h_'.$tag.'($param = null){ echo "<'.$tag.'"; if($param != null) echo " ".$param; echo ">"; }');
}
function t_stop($tag){
eval('function h_'.$tag.'_end(){ echo "</'.$tag.'>"; }');
}
function h_print($context){
echo $context;
}

t_init($singleton, $tags);
?>
106 changes: 0 additions & 106 deletions my_function.php

This file was deleted.