Wiki: CMS HTML Helper v5.5 - 2016.09.09

Topnew HTML helper (cms/cms_html.php) is a collection of functions to generate common html code.

cms_html_css($css)

$css = 'path/file.css' to include the css file; or
$css = ['class' => 'css class', 'id' => '...', ...] to get block of css code

cms_html_js($js)

$js = 'path/file.js' to include the js file; or
$js = 'block of js code' output as <script>js code here</script>

cms_html_meta($meta, $text, $var) == cms_meta(...)

echo cms_html_meta('css', 'path/all.css');
echo cms_html_meta('css', 'path/print.css', 'print');
echo cms_html_meta('js',  'path/all.js');
echo cms_html_meta('js',  '', 'block of js code');
echo cms_html_meta('refresh', 'contents');
echo cms_html_meta('icon', 'defult.ico');
echo cms_html_meta('icon', 'apple-touch-icon57.ico', 'apple');
echo cms_html_meta('any other meta', 'contents of meta');

cms_html_nav([home, folder, file], $para)

To produce: Home . folder . file navigation bar

cms_html_list($list, $para)

Produce a list ol ul

cms_html_media($media, $para)

echo cms_html_media(['video/mp4' => 'my_mob.mp4'], ['width' => 500, 'controls']);
echo cms_html_media('my_mob.webm']);
echo cms_html_media('a.mpg', ['fmt' => 'video']);//pmg mpeg avi wmv mov rm ram swf flv ogg
echo cms_html_media(['audio/mp3' => 'music.mp3'], $para);
echo cms_html_media('music.wav');//mid midi wma aac
echo cms_html_media('music.rm', ['fmt' => 'audio', 'class'=> ...]);//rm ram ogg mp4

cms_html_a($href, $txt, $para)

echo cms_html_a('a.html', 'my page', ['class'=>'red', 'id'=>...]);

cms_html_img($src, $para)

echo cms_html_img('a.png', ['class'=>'red', 'id'=>...]);

cms_html_para($para)

$string = cms_html_para(['class'=>'css class', 'disabled', 'id'=>...]);

cms_html_add($html, $add, $attr)

Add extra code into html attributes, if attribute not exist create it, else append to end

$html = cms_html_add('class="red"', 'bold', 'class');
$html = cms_html_add("class='red'", 'bold', 'class');
$html = cms_html_add('ClaSS = "red"', 'bold', 'class');
//$html = 'class="red bold"';

$html = cms_html_add('class="red"', 'margin:0');//default attr=style
//$html = 'class="red" style="margin:0"';
$html = cms_html_add('class="red" style="padding:0"', 'margin:0');
//$html = 'class="red" style="padding:0;margin:0"';

$html = cms_html_add('class="red"', 'abc', 'id');
//$html = 'class="red" id="abc"';

cms_html8($str = '')

return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');

bank BenSon Bank
Cash Manager

blog Blog Forum
Blog BBS Ticket

chart SVG Chart
PHP SVG Chart

save Page Maker
Page Maker

topnew SIDU DB GUI
Database tool