[phplib] Using Menu class with single PHP file and multiple parameters From: Emre Bastuz (info <email protected>)
Date: 09/27/00

Hi,

Iīve beend trying to use the Menu class of the phplib 7.2c but canīt
figure out how to use a single file (e.g. index.php3) instead of mutliple
target files for the different menu entries. According to the menu point
selected I want to transmit different variables to the same script.

The menu itself is supposed to look like this:
         Main
          +Do this
          +Do that
            +Do more of that
            +Do even more of that
etc.

The links are suppposed to be:
  $PHP_SELF?function=do_this
  $PHP_SELF?function=do_that
  $PHP_SELF?function=do_that&parameter=do_more_of_that
  $PHP_SELF?function=do_that&parameter=do_even_more_of_that

etc.

How is a local.inc supposed to look like if I want to create a menu like
the one mentioned above ?

Iīve tried the following, but the resulting table is empty:

[local.inc]
<?
class Example_Menu extends Menu {
   # Map of PHP_SELF URL strings to menu positions
        var $urlmap = array(
          "" => "",
          "?func=do_this" => "/1",
          "?func=do_that" => "/2",
          "?func=do_that&parameter=do_more_of_that" => "/2/1",
          "?func=do_that&parameter=do_even_more_of_that" => "/2/2"
        );

        # Information about each menu item
        var $item = array(
          "" => array("title" => "Main"),
          "/1" => array("title" => "Do This"),
          "/2" => array("title" => "Do That"),
          "/2/1" => array("title" => "Do more of that"),
          "/2/2" => array("title" => "Do even more of that")
        );

        function Example_Menu() {
          $this->setup();
        }
      }
?>
[/local.inc]

The 'application' would be:
[index.php3]
<?php
require ("local.inc");

$m = new Example_Menu;
?>

<html>
<head>
<title><?php //$m->get_menu() ?></title>
</head>

<body bgcolor="#ffffff">

<table border=1 bgcolor="#eeeeee" cellspacing=0 cellpadding=4>
<tr>
<td colspan=2 valign=top align=center>
<h1>Titel<?php print $m->title ?></h1>
</td>
</tr>
<tr>
<td align=left valign=top><?php $m->show() ?></td>
<td align=left valign=top>Content</td>
</tr>
</table>

</body>
</html>
[/index.php3]

Does anyone have an idea what I am doing wrong ?

BTW: what the $%& is the entry '$m->get_menu()' for ?
This function doesnīt exist, again one of those phplib
documentation bugs ?

Another question: why is the Menu class only mentioned in
the shipped documentation of the phplib and not on the
phplib homepage ?

Yet another question: I canīt find a menu_button.inc anywhere ?
Did it ever exist, or did I just fail to read the appropriate part
of the docs ? :-)

Iīd appreciate any hint !

Thanks,

Emre

-- 
Emre Bastuz
info <email protected>              http://www.emre.de
UIN: 561260           PGP Key ID: 0xEA0E2CA1

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>