Replace the html_toolbar_top() in your html.php file to get a dynamically generated toolbar...
function html_toolbar_top()
{
global $ToolBar, $HomePage, $PrefsScript;
$BarEd=explode(" | ", $ToolBar);
$len = sizeof($BarEd);
// $RetBar = '
// <form method="get" action="'
// . $FindScript
// . '">';
$RetBar = $RetBar . html_ref($HomePage, "Home") . " | ";
for ($i = 0; $i < $len ; $i++ ) {
$RetBar = $RetBar . html_ref($BarEd[$i], $BarEd[$i]) . " | ";
}
$RetBar = $RetBar . '<a href="' . $PrefsScript . '">Preferences</a>';
// $RetBar = $RetBar .
// ' | <input type="hidden" name="action" value="find" />
// Search: <input type="text" name="find" size="20" style="background-color: #EEEEEE; border: none; border-bottom: 1px solid #CCCCAA; padding: 0px; margin: 0px;" />
// </form>
// ';
return $RetBar;
}
Then add the $ToolBar variable to your config.php, and set the contents of your toolbar as follows... (seperate the WikiNames by putting " | " inbetween them)
$ToolBar = 'HomePage | PageIndex | RecentChanges | SandBox';Uncomment the //ed parts to also get a searchbox in your toolbar...
Hope you like it,
Wybo Wiersma
Thanks for the mod, Wybo. Starting with your code, I added a change to call the parser so I can put descriptive links in the bar as well as WikiNames. Here's the description from my page...
--Chris Cooke
My version html_toolbar_top parses more than just WikiWords. It looks like this. To use it you must put
require('parse/main.php'); into edit.php. The nice thing about this one is that I can have external links and line breaks in my menu bar, to separate site-centric navigation and wiki-centric navigation.
function html_toolbar_top()
{
global $TopToolBar, $HomePage, $PrefsScript, $ParseEngine;
$NewToolBar = substr(parseText($TopToolBar,$ParseEngine,$TopToolBar),0,-7);
// $BarEd = explode(" | ",$TopToolBar);
// $len = sizeof($BarEd);
// $RetBar = '
// <form method="get" action="'
// . $FindScript
// . '">';
$RetBar = $RetBar . html_ref($HomePage, $HomePage) . " | " . $NewToolBar . " | " . '<a href="' . $PrefsScript . '">Preferences</a>';
// $RetBar = $RetBar .
// ' | <input type="hidden" name="action" value="find" />
// Search: <input type="text" name="find" size="20" style="background-color:#EEEEEE; border: none;
// </form>
// ';
return $RetBar;
}
My $TopToolBar looks like this (including the line breaks):
$TopToolBar = '[http://geekido.org/yappa/photos Photos] | [http://geekido.org/blog1 Journal] | TeachingActivities RecentChanges | WantedPages | PostingInstructions';
I upgraded to 'Tavi 0.25 and found that my toolbar was broken, even after applying the patch again. Changing my html_toolbar_top method to the following fixed the problem.
add require('parse/main.php') to find.php and edit.php pages.
function html_toolbar_top()
{
global $TopToolBar, $HomePage, $PrefsScript, $ParseEngine;
$NewToolBar = substr(parseText($TopToolBar,$ParseEngine,$TopToolBar),
strlen(html_paragraph_start()),-strlen(html_paragraph_end())-1);
// Using the strlen(...) methods adapts for changes in how 'Tavi represents
// a paragraph in html.
$RetBar = html_ref($HomePage, $HomePage) . " | " .
$NewToolBar . " | " .
'<a href="' . $PrefsScript . '">Preferences</a>';
return $RetBar;
}
It seems useful to implement both the header and footer of every page as a variable which is set in Preferences such that one may use the defaults or a custom header/footer which is simply a link to a wiki page.
...or even if the defaults could be changed through links on a wiki page. It would certainly be more flexible and elegant if it was implemented this way rather than requiring a change of the config to add items. Also, the code as implemented now breaks the feature of Tavi/Subpages listing themselves in the header. Anyone know how to fix that?