X-Git-Url: http://git.pjr.cc/?p=anyhammer.git;a=blobdiff_plain;f=libanyhammer%2Fweb.php;fp=libanyhammer%2Fweb.php;h=87f7867e8dc1b5bc4242a31acaf98d06d0bf1f9a;hp=0000000000000000000000000000000000000000;hb=8614731736208c3bc37648efcca8838ca2e3b629;hpb=51128d918b3a3638db8d4717a76ce888aad18564
diff --git a/libanyhammer/web.php b/libanyhammer/web.php
new file mode 100644
index 0000000..87f7867
--- /dev/null
+++ b/libanyhammer/web.php
@@ -0,0 +1,94 @@
+config = $config;
+ }
+
+ function go($url)
+ {
+ echo "hello, $url";
+ error_log("called as $url");
+ }
+
+
+
+ private $config;
+}
+
+
+function AHpageBuilder($bodyClass, $bodyFunction, $bodycontent=null, $title="AnyHammer")
+{
+ global $WEB_ROOT_FS, $BASE_URL;
+
+ // TODO: load css
+ // header
+ echo "
$title";
+
+ // load css
+ if(file_exists("$WEB_ROOT_FS/css")) {
+ $dh = opendir("$WEB_ROOT_FS/css");
+ if($dh) {
+ while(($file = readdir($dh))!==false) {
+ $mt = preg_match("/.*.css$/", $file);
+ if($mt > 0) {
+ error_log("loading css $file");
+ echo "";
+ //echo "required $basedir/$file\n";
+ }
+ }
+ }
+ }
+
+ // load js
+ if(file_exists("$WEB_ROOT_FS/js")) {
+ $dh = opendir("$WEB_ROOT_FS/js");
+ if($dh) {
+ while(($file = readdir($dh))!==false) {
+ $mt = preg_match("/.*.js$/", $file);
+ if($mt > 0) {
+ error_log("loading js $file");
+ echo "";
+ //echo "required $basedir/$file\n";
+ }
+ }
+ }
+ }
+
+
+ // start body
+ echo "";
+
+ // page top
+ echo "$title
";
+ echo "";
+ AHMessageBuilder();
+ echo " | |
";
+
+ // menu, then body
+ echo "";
+ AHMenuBuilder();
+ echo " | ";
+ // body
+ $url = "/";
+ if(isset($_REQUEST["q"])) {
+ $url = $_REQUEST["q"];
+ }
+
+ if($bodyClass != null) {
+ $bodyClass->$bodyFunction($url);
+ } else if( $bodyFunction != null) {
+ $bodyFunction($url);
+ } else echo $bodycontent;
+ echo " | ";
+
+
+ // close the big wrap-around table
+ echo " |
";
+
+ // footer
+ echo "
Copyright 2011, PJR
";
+
+}
+?>
\ No newline at end of file