|
From: Steve W. <sw...@wc...> - 2000-06-07 01:12:33
|
I spent a little time tonight trying to think of a way to make theme
changes easier. A good starting place is the horrendous looking
WikiToolBar() (what was I thinking when I coded this? Probably that I
wouldn't have to be bothered with it again :-)
_________________________________________________________
function WikiToolBar() {
global $ScriptUrl, $pagename, $pagehash;
$enc_name = rawurlencode($pagename);
$retval = "<hr>\n" .
"<a href=\"$ScriptUrl?edit=$enc_name\">EditText</a>\n" .
" of this page\n";
if (is_array($pagehash)) {
$retval .= " (last edited " . $pagehash["date"] . ")\n";
}
$retval .= "<br>\n" .
"<a href=\"$ScriptUrl?FindPage\">" .
"FindPage</a> by browsing or searching\n";
return $retval;
}
----------------------------------------------------------
PHP definitely has its limitations in this department. My solution
tonight, through the haze of NyQuil and aspirin and orange juice and tea,
was to move all this into a new file in a new directory,
"elements/wiki_toolbar.inc". After some cleanup I got this:
___________________________________________________________
<?
// set up variables for display
$enc_name = rawurlencode($pagename);
if (is_array($pagehash)) {
$last_edit = " (last edited " . $pagehash["date"] . ")\n";
}
?>
<hr>
<a href="<?
echo "$ScriptUrl?edit=$enc_name";
?>">EditText</a> of this page
<? echo "$last_edit"; ?>
<br>
<a href="<? echo "$ScriptUrl"; ?>?FindPage">FindPage</a> by browsing
or searching
------------------------------------------------------------
This isn't much better. When it comes to fine-grained mixing of PHP and
HTML, the end result is uglier than a modern strip mall.
I don't feel like commiting this. Any suggestions? If I go this route, the
three functions WikiHeader, WikiToolBar, and WikiFooter will be replaced
by .inc files. The other thing I don't like is having file names hardcoded
all over the place, so all three would have to be defined in
wiki_config.php3 as well.
sw
...............................ooo0000ooo.................................
Hear FM quality freeform radio through the Internet: http://wcsb.org/
home page: www.wcsb.org/~swain
|