From 57f02306e09ee78802bab35f8dd599372c46a31a Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 29 Jan 2006 17:54:06 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2, which included commits to RCS files with non-trunk default branches. --- php/example.css | 79 +++++++++++++++++++++++ php/example1.php | 23 +++++++ php/example2.php | 23 +++++++ php/leftbar.php | 186 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ php/leftbar.txt | 42 +++++++++++++ 5 files changed, 353 insertions(+) create mode 100644 php/example.css create mode 100644 php/example1.php create mode 100644 php/example2.php create mode 100644 php/leftbar.php create mode 100644 php/leftbar.txt (limited to 'php') diff --git a/php/example.css b/php/example.css new file mode 100644 index 0000000..7fd715a --- /dev/null +++ b/php/example.css @@ -0,0 +1,79 @@ +.lb_toplink +{ + font-size: small; +} + +.lb_sublink +{ + font-size: x-small; +} + +body +{ + font-size: small; + font-family: sans-serif; + background: white; + color: black; +} + +a:link +{ + font-style: normal; + font-weight: bold; + text-decoration: none; + color: black; +} + +a:visited +{ + font-style: normal; + font-weight: bold; + text-decoration: none; + color: black; +} + +a:hover +{ + font-style: normal; + font-weight: bold; + text-decoration: underline; + color: black; +} + +a:active +{ + font-style: normal; + font-weight: bold; + text-decoration: underline; + color: black; +} + +div.leftbar +{ + width: 200px; + min-width: 200px; + border: 1px solid black; + padding: 0.25em; + float: left; + background-color: #aaaaff; +} + +h2.lb_header +{ + border: 1px none blue; + padding: 0.1em; + margin: 0em; + background-color: blue; + color: white; + font-size: medium; +} + +li.lb_linklist +{ + list-style-type: none; +} + +li.lb_sublist +{ + list-style-type: none; +} diff --git a/php/example1.php b/php/example1.php new file mode 100644 index 0000000..3b33e7e --- /dev/null +++ b/php/example1.php @@ -0,0 +1,23 @@ + + + + + +Example 1 + + + + +

Example 1

+ +
+ +
+ +

Welcome to example page one.

+ + + + diff --git a/php/example2.php b/php/example2.php new file mode 100644 index 0000000..7b36a5f --- /dev/null +++ b/php/example2.php @@ -0,0 +1,23 @@ + + + + + +Example 2 + + + + +

Example 2

+ +
+ +
+ +

Welcome to example page two.

+ + + + diff --git a/php/leftbar.php b/php/leftbar.php new file mode 100644 index 0000000..05e3213 --- /dev/null +++ b/php/leftbar.php @@ -0,0 +1,186 @@ +url=$u; + $this->text=$t; + } +} + +function LB_LeftHeader($hdr) +{ + printf('

%s

',$hdr); +} + +function LB_TopLink($url,$txt) +{ + printf('',$url,$txt); +} + +function LB_SubLink($url,$txt) +{ + printf('
  • %s
  • ',$url,$txt); +} + +function LB_OpenLink(&$is_open) +{ + if (!$is_open) + { + $is_open = TRUE; + echo ''; + echo ''; + } +} + +function LeftBar($file, $context = '') +{ + $fp = fopen($file,'r'); + + if (!$fp) + { + printf('

    Missing leftbar config %s!

    ',$file); + return; + } + + $links = array(); + $curcontext = ''; + $in_link = FALSE; + $in_sub = FALSE; + + while (!feof($fp)) + { + $line = fgets($fp,1024); + + $line = rtrim($line); + + if (strlen($line)>0 && substr($line,0,1)!='#') + { + $tok = explode("\t",$line); + + switch($tok[0]) + { + case 'def': + if (count($tok)==4) + { + $links[$tok[1]] = new LB_LinkDef($tok[3],$tok[2]); + } + else + { + printf('

    WARNING: Bad "def"

    '); + } + break; + + case 'set': + if (count($tok)==2) + { + LB_CloseSub($in_sub); + LB_CloseLink($in_link); + LB_LeftHeader($tok[1]); + } + else + { + printf('

    WARNING: Bad "set"

    '); + } + break; + + case 'link': + if (count($tok)==3) + { + LB_CloseSub($in_sub); + LB_OpenLink($in_link); + $ldef = $links[$tok[1]]; + $curcontext = $tok[2]; + LB_TopLink($ldef->url,$ldef->text); + } + else + { + printf('

    WARNING: Bad "link"

    '); + } + break; + + case 'sub': + if (count($tok)==2) + { + if ($curcontext == $context) + { + LB_OpenSub($in_sub); + $ldef = $links[$tok[1]]; + LB_SubLink($ldef->url,$ldef->text); + } + } + else + { + printf('

    WARNING: Bad "sub"

    '); + } + break; + + default: + printf('

    WARNING: Bad line "%s"

    ',$line); + break; + } + } + } + + LB_CloseSub($in_sub); + LB_CloseLink($in_link); + + fclose($fp); +} +?> diff --git a/php/leftbar.txt b/php/leftbar.txt new file mode 100644 index 0000000..32fc683 --- /dev/null +++ b/php/leftbar.txt @@ -0,0 +1,42 @@ +# $Id$ +# +# * Blank lines and lines starting '#' are ignored. +# * Commands and arguments are tab seperated. +# + + +# The def command is: +# +# def link_id link_text url +# +def about About Noddybox /about.php +def google1 Google (com) http://www.google.com/ +def google2 Google (UK) http://www.google.co.uk/ +def bsd Free BSD http://www.freebsd.org/ +def micro Microsoft http://www.microsoft.com/ +def ex1 Example 1 example1.php +def ex2 Example 2 example2.php + +# A set and its links are defined as: +# +# set text +# link link_id context +# sub link_id +# +# For link use '-' is there is no context. +# +set Set 1 +link about - +link bsd - + +set Set 2 +link google1 - +link google2 - +link ex1 context_ex1 +sub ex2 +link bsd - + +set Set 3 +link google1 - +link google2 - +link micro - -- cgit v1.2.3