Functions
WebDev/*nix assorted functions & hacks
Search
find all
Array
-
Bash
-
Classes
-
Config
-
DateTime
-
Debug
-
dotjs
-
File
-
foooo
-
Git
-
HTML
-
Images
-
Javascript
-
Linux
-
Math
-
Misc
-
MySQL
-
OS X
-
Reading
-
Redis
-
Shell scripts
-
snippets
-
SQL
-
Strings
-
TextMate
-
Web
-
\(^o^)/ Fun!
-
_Misc hacks
-
_Pages
HTML
* Readme
pageStart($list)
popup_link(...)
styled($string, $color='black', $style='')
template($file, $assoc_data)
5
found
auth
Name:
Category: HTML
Body:
// if $list is a string, it's taken to be the title, else an assoc string of parameters // $list['stylesheet'] can also be an array of sheets // updated [2013-02-18 12:11:00] //____________________ // pageStart($list) / function pageStart($list) { global $me; $defaults = array( 'stylesheet' => array(), 'style' => array(), 'js_include' => array(), 'jquery' => '', 'include_jquery' => True, 'javascript' => array(), 'headertags' => array(), 'body' => '', 'charset' => 'UTF-8', ); if (! is_array($list)) $list = array('title'=>$list); // if not array, assume title string $list = array_merge($defaults, (array) $list); // merge default values with custom, latter overrides earlier extract($list); echo "<!DOCTYPE html> <html> <head> <meta http-equiv='content-type' content='text/html; charset=$charset'> <title>". ($title?$title:'untitled') ."</title>\n"; if ($headertags) { if (! is_array($headertags)) $headertags = array($headertags); foreach ($headertags as $tag) { echo "\t$tag\n"; } } if ($include_jquery) { echo "\t<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js' type='text/javascript'></script>\n"; } if ($js_include) { if (! is_array($js_include)) $js_include = array($js_include); foreach($js_include as $js_incl) { echo "\t<script src='$js_incl' type='text/javascript'></script>\n"; } } if ($stylesheet) { if (! is_array($stylesheet)) $stylesheet = array($stylesheet); foreach($stylesheet as $tmp) { echo "\t<link rel='stylesheet' type='text/css' href='$tmp'>\n"; } } if ($jquery) { echo '<script type="text/javascript"> $(function(){ '.join("\n", (array) $jquery).' }); </script>'."\n"; } if ($style) { if (! is_array($style)) $style = array($style); echo "<style type='text/css'>\n"; foreach($style as $tmp) { echo "\t$tmp\n"; } echo "</style>\n"; } if ($javascript) { if (! is_array($javascript)) $javascript = array($javascript); foreach($javascript as $js) { $tags = (bool) strpos(strtolower($js), '</script>'); echo $tags ? $js."\n" : "<script type='text/javascript'>\n$js\n</script>\n"; } } echo "</head>\n"; if ($body !== False) echo "<body".($body ? " $body":'').">\n\n"; }
Footer