page skeleton and rough component framework
[confetti] / page.sh
1 #!/bin/zsh
2
3 echo "Content-Type: text/html\n\n"
4
5 PAGE="$(echo "$_GET['page']" |egrep '^[a-zA-Z0-9_-]+$')"
6 PAGE="${_EXEC}/ifcomponent/page_${PAGE}.sh"
7 [ -x "$PAGE" ] || PAGE="${_EXEC}/ifcomponent/page_error.sh"
8
9 TITLE=$($PAGE title)
10
11 NAVIGATION() {
12   for each in "${_EXEC}/ifcomponent"/page_*.sh; do
13     link="$(echo "$each" |sed -r "s:^.*page_(.*)\.sh$:\1:")"
14     title="$($each title)"
15     echo "/?page=$link $title"
16   done
17 }
18
19 . ${_EXEC}/ifcomponent/frame.sh