]> git.plutz.net Git - confetti/blobdiff - page.sh
page skeleton and rough component framework
[confetti] / page.sh
diff --git a/page.sh b/page.sh
new file mode 100755 (executable)
index 0000000..ef1cf4d
--- /dev/null
+++ b/page.sh
@@ -0,0 +1,19 @@
+#!/bin/zsh
+
+echo "Content-Type: text/html\n\n"
+
+PAGE="$(echo "$_GET['page']" |egrep '^[a-zA-Z0-9_-]+$')"
+PAGE="${_EXEC}/ifcomponent/page_${PAGE}.sh"
+[ -x "$PAGE" ] || PAGE="${_EXEC}/ifcomponent/page_error.sh"
+
+TITLE=$($PAGE title)
+
+NAVIGATION() {
+  for each in "${_EXEC}/ifcomponent"/page_*.sh; do
+    link="$(echo "$each" |sed -r "s:^.*page_(.*)\.sh$:\1:")"
+    title="$($each title)"
+    echo "/?page=$link $title"
+  done
+}
+
+. ${_EXEC}/ifcomponent/frame.sh