Revision 1779
Added by Luisehahne about 13 years ago
| branches/2.8.x/CHANGELOG | ||
|---|---|---|
| 13 | 13 |
|
| 14 | 14 |
|
| 15 | 15 |
|
| 16 |
09 Oct-2012 Build 1779 Dietmar Woellbrink (Luisehahne) |
|
| 17 |
# fixed wrong variable in admin/settings/index.php line 409 |
|
| 18 |
! coreecting url to WB help in readme files module showmenu2 |
|
| 16 | 19 |
05 Oct-2012 Build 1778 Dietmar Woellbrink (Luisehahne) |
| 17 | 20 |
# fixed empty template variable in admin/start |
| 18 | 21 |
01 Oct-2012 Build 1777 Dietmar Woellbrink (Luisehahne) |
| branches/2.8.x/wb/admin/interface/version.php | ||
|---|---|---|
| 51 | 51 |
|
| 52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
| 53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.3');
|
| 54 |
if(!defined('REVISION')) define('REVISION', '1778');
|
|
| 54 |
if(!defined('REVISION')) define('REVISION', '1779');
|
|
| 55 | 55 |
if(!defined('SP')) define('SP', '');
|
| branches/2.8.x/wb/admin/settings/index.php | ||
|---|---|---|
| 406 | 406 |
} else {
|
| 407 | 407 |
$oTpl->set_var(array( |
| 408 | 408 |
'PRIVATE_DISABLED' => $checked, |
| 409 |
'INTRO_PAGE_ENABLED' => '',
|
|
| 409 |
'PRIVATE_ENABLED' => '',
|
|
| 410 | 410 |
)); |
| 411 | 411 |
} |
| 412 | 412 |
|
| branches/2.8.x/wb/modules/show_menu2/README.de.txt | ||
|---|---|---|
| 1 | 1 |
show_menu2, version 4.9 |
| 2 | 2 |
======================= |
| 3 |
Ist ein Code-Snippet für das CMS Website Baker. Es stellt einen kompletten
|
|
| 4 |
Ersatz für die eingebaute Menüfuntionalität zur Verfügung. Alle, für die
|
|
| 5 |
Erzeugung des Menüs erforderlichen Daten, werden durch eine einzige
|
|
| 6 |
Datenbankabfrage erzeugt. Durch umfangreiche Anpassungsmöglichkeiten des
|
|
| 7 |
erzeugten HTML-Code können alle möglichen Menüarten (Listen, Breadcrumbs,
|
|
| 3 |
Ist ein Code-Snippet für das CMS Website Baker. Es stellt einen kompletten |
|
| 4 |
Ersatz für die eingebaute Menüfuntionalität zur Verfügung. Alle, für die |
|
| 5 |
Erzeugung des Menüs erforderlichen Daten, werden durch eine einzige |
|
| 6 |
Datenbankabfrage erzeugt. Durch umfangreiche Anpassungsmöglichkeiten des |
|
| 7 |
erzeugten HTML-Code können alle möglichen Menüarten (Listen, Breadcrumbs, |
|
| 8 | 8 |
Sitemaps, usw.) erzeugt werden. |
| 9 | 9 |
|
| 10 | 10 |
--- |
| 11 |
Deutsche Übersetzung von BerndJM. Dies ist eine weitgehend direkte Übersetzung
|
|
| 12 |
des englischen Originals. Bei Übersetzungs- oder Interpretationsfehlern, bitte
|
|
| 11 |
Deutsche Übersetzung von BerndJM. Dies ist eine weitgehend direkte Übersetzung |
|
| 12 |
des englischen Originals. Bei Übersetzungs- oder Interpretationsfehlern, bitte |
|
| 13 | 13 |
eine Email an bjm@wwnw.de. |
| 14 | 14 |
--- |
| 15 | 15 |
|
| ... | ... | |
| 25 | 25 |
5. Im Abschnitt "Modul installieren" das im Schritt 1 heruntergeladene zip-File |
| 26 | 26 |
auswählen und installieren. |
| 27 | 27 |
|
| 28 |
|
|
| 29 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 | 30 |
BENUTZUNG VON SHOW_MENU2 |
| 31 | 31 |
======================== |
| 32 |
Um show_menu2 zu benutzen muss das verwendete Template an den Stellen
|
|
| 33 |
modifiziert werden, an denen das Menü erscheinen soll. Bitte beachten: Wenn alte
|
|
| 34 |
Menüaufrufe ersetzt werden, müssen unbedingt auch die entsprechenden neuen
|
|
| 32 |
Um show_menu2 zu benutzen muss das verwendete Template an den Stellen |
|
| 33 |
modifiziert werden, an denen das Menü erscheinen soll. Bitte beachten: Wenn alte |
|
| 34 |
Menüaufrufe ersetzt werden, müssen unbedingt auch die entsprechenden neuen |
|
| 35 | 35 |
Parameter verwendet werden die show_menu2 benötigt. |
| 36 | 36 |
|
| 37 |
In den meisten Fällen genügt bereits der Standardaufruf ohne weitere Parameter
|
|
| 38 |
von show_menu2. In diesem Fall werden die Vorgabewerte verwendet, dies erzeugt
|
|
| 37 |
In den meisten Fällen genügt bereits der Standardaufruf ohne weitere Parameter |
|
| 38 |
von show_menu2. In diesem Fall werden die Vorgabewerte verwendet, dies erzeugt |
|
| 39 | 39 |
ein Menü das die aktuelle Seite und die Unterseiten der aktuellen Seite anzeigt: |
| 40 |
|
|
| 40 |
|
|
| 41 | 41 |
show_menu2(); |
| 42 |
|
|
| 42 |
|
|
| 43 | 43 |
Bitte beachten: der Aufruf von show_menu2 ist PHP und muss normalerweise in PHP- |
| 44 |
Codezeichen eingeschlossen werden (ausser der Aufruf erfolgt bereits innerhalb
|
|
| 44 |
Codezeichen eingeschlossen werden (ausser der Aufruf erfolgt bereits innerhalb |
|
| 45 | 45 |
von PHP Code): |
| 46 | 46 |
|
| 47 | 47 |
<?php show_menu2(); ?> |
| 48 | 48 |
|
| 49 |
Dieses Vorgabe Menü erzeugt bereits ein komplettes Menü auf Listenbasis mit
|
|
| 50 |
etlichen Klassen, die eine leichte Formatierung mittels CSS ermöglichen. Es wird
|
|
| 51 |
z.B. die Klasse "menu-current" zu dem <li> tag des aktuellen Menüpunktes
|
|
| 52 |
hinzugefügt. Zusätzlich erhält jeder Menüpunkt der Unterpunkte enthält die
|
|
| 53 |
Klasse "menu-expand". Das erlaubt es sehr differenzierte CSS Regeln für die
|
|
| 49 |
Dieses Vorgabe Menü erzeugt bereits ein komplettes Menü auf Listenbasis mit |
|
| 50 |
etlichen Klassen, die eine leichte Formatierung mittels CSS ermöglichen. Es wird |
|
| 51 |
z.B. die Klasse "menu-current" zu dem <li> tag des aktuellen Menüpunktes |
|
| 52 |
hinzugefügt. Zusätzlich erhält jeder Menüpunkt der Unterpunkte enthält die |
|
| 53 |
Klasse "menu-expand". Das erlaubt es sehr differenzierte CSS Regeln für die |
|
| 54 | 54 |
einzelnen Menüpunkte aufzustellen. |
| 55 | 55 |
Zum Beispiel: |
| 56 | 56 |
|
| 57 | 57 |
li.menu-expand { font-weight: bold; }
|
| 58 | 58 |
li.menu-current { background: red; }
|
| 59 | 59 |
|
| 60 |
Im Abschnitt "HTML-Ausgabe" findet sich eine detaillierte Beschreibung welche
|
|
| 61 |
Klassen welchem Element zugeordnet werden. Durch die Verwendung von
|
|
| 62 |
verschiedenen Parametern bei dem show_menu2 Funktionsaufruf lassen sich auch
|
|
| 63 |
recht umfangreiche und unterschiedliche Menüstrukturen erzeugen. Um
|
|
| 64 |
beispielsweise nur Menüpunkte aus der obersten Ebene der Menüstruktur
|
|
| 60 |
Im Abschnitt "HTML-Ausgabe" findet sich eine detaillierte Beschreibung welche |
|
| 61 |
Klassen welchem Element zugeordnet werden. Durch die Verwendung von |
|
| 62 |
verschiedenen Parametern bei dem show_menu2 Funktionsaufruf lassen sich auch |
|
| 63 |
recht umfangreiche und unterschiedliche Menüstrukturen erzeugen. Um |
|
| 64 |
beispielsweise nur Menüpunkte aus der obersten Ebene der Menüstruktur |
|
| 65 | 65 |
darzustellen, könnte man folgenden Aufruf verwenden: |
| 66 | 66 |
|
| 67 | 67 |
show_menu2(0, SM2_ROOT, SM2_START); |
| 68 |
|
|
| 68 |
|
|
| 69 | 69 |
Oder um beispielsweise bis zu zwei Unterebenen der aktuellen Seite anzuzeigen: |
| 70 | 70 |
|
| 71 | 71 |
show_menu2(0, SM2_CURR+1, SM2_CURR+2); |
| 72 | 72 |
|
| 73 |
Es gibt jede Menge Möglichkeiten, um die unterschiedlichsten Menüstrukturen zu
|
|
| 73 |
Es gibt jede Menge Möglichkeiten, um die unterschiedlichsten Menüstrukturen zu |
|
| 74 | 74 |
erzeugen. Zahlreiche Beispiele dazu findet man auf der Demo-Website: http:// |
| 75 | 75 |
code.jellycan.com/sm2test/ |
| 76 | 76 |
|
| ... | ... | |
| 79 | 79 |
HÄUFIGE FRAGEN |
| 80 | 80 |
============== |
| 81 | 81 |
|
| 82 |
Q: Ich bin kein Programmierer. Gibt es keine einfachere Dokumentation?
|
|
| 82 |
Q: Ich bin kein Programmierer. Gibt es keine einfachere Dokumentation? |
|
| 83 | 83 |
A: Nein, denn dies hier ist bereits die einfache Dokumentation. |
| 84 | 84 |
|
| 85 | 85 |
|
| 86 | 86 |
Q: Wie kann ich ein sogenanntes Drop-Down Menü erstellen? |
| 87 | 87 |
A: Dies hat nichts mit show_menu2 zu tun. Um ein Drop-Down Menü zu erzeugen muß |
| 88 |
lediglich der CSS-Code des jeweiligen Templates angepaßt werden. Die nötigen
|
|
| 89 |
Anpassungen findet man z.B. im "allcss2" Template aus dem WB Addon
|
|
| 90 |
Repository -> http://addons.websitebaker.org/pages/templates.php
|
|
| 88 |
lediglich der CSS-Code des jeweiligen Templates angepaßt werden. Die nötigen |
|
| 89 |
Anpassungen findet man z.B. im "allcss2" Template aus dem WB Addon |
|
| 90 |
Repository -> http://addons.websitebaker.org/ |
|
| 91 | 91 |
|
| 92 | 92 |
|
| 93 |
Q: Warum verschwindet das Menü nachdem ich in einer mehrsprachigen WB-Site die
|
|
| 93 |
Q: Warum verschwindet das Menü nachdem ich in einer mehrsprachigen WB-Site die |
|
| 94 | 94 |
Suchfunktion benutzt habe? |
| 95 | 95 |
A: Im verwendeten Template fehlen die notwendigen Zeilen: |
| 96 | 96 |
|
| 97 |
1. Im WB Admin Backend: Optionen -> Erweiterte Optionen anzeigen ->
|
|
| 98 |
Suchoptionen -> Kopfzeile - hier direkt nach dem öffnenden <form> tag
|
|
| 97 |
1. Im WB Admin Backend: Optionen -> Erweiterte Optionen anzeigen -> |
|
| 98 |
Suchoptionen -> Kopfzeile - hier direkt nach dem öffnenden <form> tag |
|
| 99 | 99 |
folgende Zeile einfügen: |
| 100 |
|
|
| 100 |
|
|
| 101 | 101 |
<input type="hidden" name="referrer" value="[REFERRER_ID]" /> |
| 102 | 102 |
|
| 103 |
2. In der index.php des verwendeten Templates folgende Zeile unmittelbar
|
|
| 103 |
2. In der index.php des verwendeten Templates folgende Zeile unmittelbar |
|
| 104 | 104 |
nach dem öffnenden <form> tag der Suche einfügen: |
| 105 | 105 |
|
| 106 | 106 |
<input type="hidden" name="referrer" value="<?php echo defined('REFERRER_ID')?REFERRER_ID:PAGE_ID;?>" />
|
| 107 | 107 |
|
| 108 | 108 |
|
| 109 | 109 |
Q: Mehrsprachig? Das klingt toll. Wie macht man das? |
| 110 |
A: http://help.websitebaker.org/pages/de/advanced-doku/designer-guide/mehrsprachige-webseiten.php
|
|
| 110 |
A: http://www.websitebaker2.org/de/hilfe/designerhandbuch/mehrsprachige-webseiten.php
|
|
| 111 | 111 |
|
| 112 | 112 |
|
| 113 | 113 |
Q: Jedesmal wenn eine Seite aufgerufen wird, erzeugt SM2 folgende Warnmeldung: |
| 114 | 114 |
"show_menu2 error: $aOptions is invalid. No flags from group 1 supplied!" |
| 115 |
A: Der Funktion wurden die falschen Werte oder eine falsche Anzahl an
|
|
| 115 |
A: Der Funktion wurden die falschen Werte oder eine falsche Anzahl an |
|
| 116 | 116 |
Werten übergeben. |
| 117 |
Siehe den Abschnitt PARAMETER für die korrekten Flag Werte die dem
|
|
| 118 |
$aOptions Parameter zu übergeben sind.
|
|
| 117 |
Siehe den Abschnitt PARAMETER für die korrekten Flag Werte die dem |
|
| 118 |
$aOptions Parameter zu übergeben sind. |
|
| 119 | 119 |
|
| 120 | 120 |
|
| 121 | 121 |
Q: How do I use a different class/picture/color/widget for each entry in a menu? |
| 122 |
A: Use the [page_id] format string in the $aItemOpen string. Create a unique
|
|
| 122 |
A: Use the [page_id] format string in the $aItemOpen string. Create a unique |
|
| 123 | 123 |
class or id for each menu item, then reference that item in your CSS or Javascript |
| 124 | 124 |
to do whatever you want. |
| 125 |
|
|
| 125 |
|
|
| 126 | 126 |
To add a unique class for each menu item (or similar): |
| 127 |
|
|
| 127 |
|
|
| 128 | 128 |
"<li><a href="[url]" target="[target]" class="[class] p[page_id]">[menu_title]</a>" |
| 129 | 129 |
|
| 130 | 130 |
... creating menu items like ... |
| 131 |
|
|
| 131 |
|
|
| 132 | 132 |
<li><a href="/pages/foo/bar.php" target="_top" class="menu-top p45">Top Menu</a> |
| 133 | 133 |
|
| 134 | 134 |
Reference this in your CSS like: |
| 135 |
|
|
| 135 |
|
|
| 136 | 136 |
a.p45 { color: red; }
|
| 137 |
|
|
| 137 |
|
|
| 138 | 138 |
To add a unique ID for each menu item (or similar): |
| 139 |
|
|
| 139 |
|
|
| 140 | 140 |
"<li><a id="p[page_id]" href="[url]" target="[target]" class="[class]">[menu_title]</a>" |
| 141 |
|
|
| 141 |
|
|
| 142 | 142 |
... creating menu items like ... |
| 143 |
|
|
| 143 |
|
|
| 144 | 144 |
<li><a id="p45" href="/pages/foo/bar.php" target="_top" class="menu-top">Top Menu</a> |
| 145 | 145 |
|
| 146 | 146 |
Reference this in your CSS like: |
| 147 |
|
|
| 147 |
|
|
| 148 | 148 |
a#p45 { color: red; }
|
| 149 |
|
|
| 149 |
|
|
| 150 | 150 |
Note that the ID can only be used if that menu is generated and displayed one time |
| 151 |
only on the page (because HTML ID's must be unique within a page).
|
|
| 152 |
|
|
| 153 |
|
|
| 151 |
only on the page (because HTML ID's must be unique within a page). |
|
| 152 |
|
|
| 153 |
|
|
| 154 | 154 |
FUNKTION |
| 155 | 155 |
======== |
| 156 | 156 |
|
| ... | ... | |
| 169 | 169 |
$aTopMenuOpen = false |
| 170 | 170 |
) |
| 171 | 171 |
|
| 172 |
Im Abschnitt "Parameter" findet sich eine detaillierte Beschreibung jedes
|
|
| 172 |
Im Abschnitt "Parameter" findet sich eine detaillierte Beschreibung jedes |
|
| 173 | 173 |
einzelnen Parameters. |
| 174 |
Jeder Parameter muß absolut korrekt verwendet werden. Folgende Regeln können
|
|
| 174 |
Jeder Parameter muß absolut korrekt verwendet werden. Folgende Regeln können |
|
| 175 | 175 |
dabei helfen: |
| 176 | 176 |
|
| 177 | 177 |
$aMenu = 0 ist in den meisten Anwendungsfällen der beste Wert. |
| 178 |
|
|
| 178 |
|
|
| 179 | 179 |
$aStart muß entweder eine page ID oder ein Wert der mit "SM2_" beginnt sein. |
| 180 |
|
|
| 180 |
|
|
| 181 | 181 |
$aMaxLevel kann nur Werte erhalten, die mit "SM2_" beginnen. |
| 182 |
|
|
| 183 |
$aOptions bis auf einige wenige Spezialfälle sind hier nur Werte die mit
|
|
| 182 |
|
|
| 183 |
$aOptions bis auf einige wenige Spezialfälle sind hier nur Werte die mit |
|
| 184 | 184 |
"SM2_" beginnen zulässig. |
| 185 |
|
|
| 186 |
Alle weiteren Parameter enthalten die (HTML)Tags die die Ausgabe des Menüs
|
|
| 185 |
|
|
| 186 |
Alle weiteren Parameter enthalten die (HTML)Tags die die Ausgabe des Menüs |
|
| 187 | 187 |
steuern. |
| 188 |
|
|
| 189 |
Ab $aItemOpen kann jedem Parameter der Wert false übergeben werden um den
|
|
| 188 |
|
|
| 189 |
Ab $aItemOpen kann jedem Parameter der Wert false übergeben werden um den |
|
| 190 | 190 |
jeweiligen Vorgabewert zu erhalten. |
| 191 | 191 |
|
| 192 |
Dies kann beispielsweise verwendet werden um eine nummerierte Liste zu
|
|
| 193 |
erzeugen, während für die einzelnen Menüpunkte trotzdem die Vorgabewerte
|
|
| 192 |
Dies kann beispielsweise verwendet werden um eine nummerierte Liste zu |
|
| 193 |
erzeugen, während für die einzelnen Menüpunkte trotzdem die Vorgabewerte |
|
| 194 | 194 |
Verwendung finden: |
| 195 | 195 |
|
| 196 | 196 |
show_menu2(0, SM2_ROOT, SM2_ALL, SM2_ALL, false, false, '<ol>', '</ol>'); |
| ... | ... | |
| 200 | 200 |
|
| 201 | 201 |
HTML-AUSGABE |
| 202 | 202 |
============ |
| 203 |
Die HTML-Ausgabe hängt wesentlich davon ab, welche Parameter an die Funktion übergeben werden.
|
|
| 204 |
Unabhängig davon werden nachfolgende Klassen grundsätzlich für jedes Menü verwendet, wobei
|
|
| 203 |
Die HTML-Ausgabe hängt wesentlich davon ab, welche Parameter an die Funktion übergeben werden. |
|
| 204 |
Unabhängig davon werden nachfolgende Klassen grundsätzlich für jedes Menü verwendet, wobei |
|
| 205 | 205 |
einzelne Menüpunkte, wenn es erforderlich ist, auch mehrere Klassen erhalten können. |
| 206 | 206 |
|
| 207 | 207 |
KLASSE ZUORDNUNG |
| ... | ... | |
| 215 | 215 |
menu-first Der erste Punkt eines jeden Menüs oder Untermenüs. |
| 216 | 216 |
menu-last Der letzte Punkt eines jeden Menüs oder Untermenüs. |
| 217 | 217 |
|
| 218 |
Folgende Klassen werden nur hinzugefügt, wenn das SM2_NUMCLASS Flag gesetzt
|
|
| 218 |
Folgende Klassen werden nur hinzugefügt, wenn das SM2_NUMCLASS Flag gesetzt |
|
| 219 | 219 |
ist: |
| 220 | 220 |
|
| 221 |
menu-N Jeder Menüpunkt, wobei das N für die ABSOLUTE Menütiefe,
|
|
| 221 |
menu-N Jeder Menüpunkt, wobei das N für die ABSOLUTE Menütiefe, |
|
| 222 | 222 |
beginnend bei 0, des jeweiligen Menüpunktes steht. |
| 223 | 223 |
Die oberste Ebene ist also immer menu-0, die nächste |
| 224 | 224 |
Ebene menu-1 usw. |
| 225 | 225 |
menu-child-N Jedes Untermenü der aktuellen Seiten, wobei das N für die |
| 226 | 226 |
RELATIVE Tiefe des Untermenüs, beginnend bei 0, steht. |
| 227 |
|
|
| 227 |
|
|
| 228 | 228 |
Beispiel einer HTML-Ausgabe: |
| 229 | 229 |
|
| 230 | 230 |
<ul class="menu-top menu-0"> |
| ... | ... | |
| 267 | 267 |
|
| 268 | 268 |
PARAMETER |
| 269 | 269 |
========= |
| 270 |
$aMenu
|
|
| 271 |
Nummer des Menüs. Diese ist nützlich um mehrere Menüs auf einer Seite zu
|
|
| 270 |
$aMenu |
|
| 271 |
Nummer des Menüs. Diese ist nützlich um mehrere Menüs auf einer Seite zu |
|
| 272 | 272 |
verwenden. |
| 273 | 273 |
Menü Nummer 0 ist das Vorgabemenü der aktuellen Seite, SM2_ALLMENU gibt alle |
| 274 | 274 |
im System verwendeten Menüs zurück. |
| 275 | 275 |
|
| 276 |
$aStart
|
|
| 277 |
Gibt an, ab welcher Ebene die Erzeugung des Menüs beginnen soll. In den
|
|
| 278 |
meisten Fällen wird dies die oberste Ebene des anzuzeigenden Menüs sein. Es
|
|
| 276 |
$aStart |
|
| 277 |
Gibt an, ab welcher Ebene die Erzeugung des Menüs beginnen soll. In den |
|
| 278 |
meisten Fällen wird dies die oberste Ebene des anzuzeigenden Menüs sein. Es |
|
| 279 | 279 |
kann einer der folgenden Werte verwendet werden: |
| 280 | 280 |
|
| 281 | 281 |
SM2_ROOT+N Beginnt N Ebenen unterhalb der obersten Ebene, z.B.: |
| ... | ... | |
| 290 | 290 |
mit allen Unterebenen |
| 291 | 291 |
|
| 292 | 292 |
page_id Verwendet die Seite mit der angegebenen page id als Elternelement. |
| 293 |
Alle Untermenüs dieser Seite werden angezeigt.
|
|
| 294 |
(Die page id kann ermittelt werden, wenn man die Seite im
|
|
| 295 |
Admin-Backend editiert, sie steht dann in der Adresszeile des
|
|
| 293 |
Alle Untermenüs dieser Seite werden angezeigt. |
|
| 294 |
(Die page id kann ermittelt werden, wenn man die Seite im |
|
| 295 |
Admin-Backend editiert, sie steht dann in der Adresszeile des |
|
| 296 | 296 |
Browsers: http://SITE/admin/pages/modify.php?page_id=35 |
| 297 | 297 |
|
| 298 |
$aMaxLevel
|
|
| 298 |
$aMaxLevel |
|
| 299 | 299 |
Die maximale Anzahl der Ebenen die angezeigt werden. Die Anzeige |
| 300 |
beginnt ab der in $aStart festgelegten Ebene, bis hin zu der hier
|
|
| 300 |
beginnt ab der in $aStart festgelegten Ebene, bis hin zu der hier |
|
| 301 | 301 |
festgelegten Ebene. |
| 302 |
|
|
| 302 |
|
|
| 303 | 303 |
SM2_ALL Keine Beschränkung, alle Ebenen werden angezeigt |
| 304 | 304 |
|
| 305 |
SM2_CURR+N Zeigt immer die aktuelle Seite + N Ebenen.
|
|
| 305 |
SM2_CURR+N Zeigt immer die aktuelle Seite + N Ebenen. |
|
| 306 | 306 |
SM2_CURR Aktuelle Ebene (keine Unterebene) |
| 307 | 307 |
SM2_CURR+3 Alle übergeordneten + aktuelle + 3 Unterebenen |
| 308 | 308 |
|
| 309 | 309 |
SM2_START+N Beginnt immer auf der Startebene + N Ebenen. |
| 310 |
Die Ebenen werden unabhängig davon angezeigt,egal
|
|
| 310 |
Die Ebenen werden unabhängig davon angezeigt,egal |
|
| 311 | 311 |
auf welcher Ebene sich die aktuelle Seite befindet. |
| 312 | 312 |
SM2_START Eine einzelne Ebene ab der Startebene. |
| 313 | 313 |
SM2_START+1 Startebene + eine Ebene darunter. |
| ... | ... | |
| 317 | 317 |
SM2_MAX Nur die Startebene (gleiche Wirkung wie SM2_START) |
| 318 | 318 |
SM2_MAX+1 Die Startebene und eine Ebene darunter. |
| 319 | 319 |
|
| 320 |
$aOptions
|
|
| 320 |
$aOptions |
|
| 321 | 321 |
Spezielle Flags für verschiedene Menügenerierungs Optionen. Sie können mittels |
| 322 | 322 |
einer ODER Verknüpfung (|) miteinander kombiniert werden. Um beispielsweise |
| 323 | 323 |
sowohl TRIM als auch PRETTY zu definieren, verwendet man: (SM2_TRIM | SM2_PRETTY). |
| ... | ... | |
| 327 | 327 |
Aus dieser Gruppe muss stets genau ein Flag angegeben werden. Diese Flags |
| 328 | 328 |
bestimmen auf welche Weise die Geschwisterelemente im Menübaum in der |
| 329 | 329 |
Ausgabe unterdrückt werden. |
| 330 |
|
|
| 330 |
|
|
| 331 | 331 |
SM2_ALL Zeigt alle Zweige des Menübaums |
| 332 |
A-1 -> B-1
|
|
| 332 |
A-1 -> B-1 |
|
| 333 | 333 |
-> B-2 -> C-1 |
| 334 | 334 |
-> C-2 (CURRENT) |
| 335 | 335 |
-> D-1 |
| ... | ... | |
| 341 | 341 |
SM2_TRIM Zeigt alle Geschwistermenüs der Seite im aktuellen Pfad. |
| 342 | 342 |
Alle Untermenüs von Elemnten die sich nicht im Pfad befinden |
| 343 | 343 |
werden entfernt. |
| 344 |
A-1 -> B-1
|
|
| 344 |
A-1 -> B-1 |
|
| 345 | 345 |
-> B-2 -> C-1 |
| 346 | 346 |
-> C-2 (CURRENT) |
| 347 | 347 |
-> D-1 |
| 348 | 348 |
-> D-2 |
| 349 | 349 |
-> C-3 |
| 350 |
A-2
|
|
| 350 |
A-2 |
|
| 351 | 351 |
|
| 352 | 352 |
SM2_CRUMB Zeigt den Breadcrumb Pfad des Menüs an, also den aktuellen |
| 353 | 353 |
Menüpunkt sowie alle Menüpunkte die dorthin führen. |
| ... | ... | |
| 365 | 365 |
------- |
| 366 | 366 |
Diese Flags sind optional, sie können in beliebiger Anzahl kombiniert werden. |
| 367 | 367 |
|
| 368 |
SM2_NUMCLASS Fügt die nummerierten Menüklassen "menu-N" und
|
|
| 368 |
SM2_NUMCLASS Fügt die nummerierten Menüklassen "menu-N" und |
|
| 369 | 369 |
"menu-child-N hinzu. |
| 370 |
|
|
| 370 |
|
|
| 371 | 371 |
SM2_ALLINFO Lädt alle Felder aus der Seitentabelle der Datenbank. |
| 372 | 372 |
Dies verursacht einen ziemlich hohen Speicherverbauch und sollte |
| 373 | 373 |
deshalb nur mit Bedacht verwendet werden. |
| ... | ... | |
| 377 | 377 |
Bitte beachten: dieses Flag muss beim ERSTEN Aufruf von schow_menu2 |
| 378 | 378 |
für die jeweilige Menü ID verwendet werden, oder in Verbindung |
| 379 | 379 |
mit SM2_NOCACHE, sonst zeigt es keine Wirkung. |
| 380 |
|
|
| 380 |
|
|
| 381 | 381 |
SM2_NOCACHE Die aus der Datenbank gelesenen Daten werden bei erneutem Aufruf von |
| 382 |
show_menu2 nicht wiederverwendet sondern erneut aus der Datenbank
|
|
| 382 |
show_menu2 nicht wiederverwendet sondern erneut aus der Datenbank |
|
| 383 | 383 |
gelesen. |
| 384 |
|
|
| 384 |
|
|
| 385 | 385 |
SM2_PRETTY Bringt die HTML-Ausgabe des Menüs mittels Leerzeichen und |
| 386 |
Zeilenumbrüchen in eine gut lesbare Form. Das ist besonders
|
|
| 386 |
Zeilenumbrüchen in eine gut lesbare Form. Das ist besonders |
|
| 387 | 387 |
nützlich beim Debuggen der Menüausgabe. |
| 388 |
|
|
| 388 |
|
|
| 389 | 389 |
SM2_BUFFER Gibt den HTML-Code nicht direkt aus, sondern speichert ihn intern |
| 390 | 390 |
zwischen und gibt ihn als kompletten String aus. |
| 391 |
|
|
| 391 |
|
|
| 392 | 392 |
SM2_CURRTREE Schliesst alle anderen Toplevelmenüs von der Betrachtung aus. |
| 393 | 393 |
Es werden nur Menüpunkte des aktuellen Menüzweiges dargestellt. |
| 394 | 394 |
Dieses Flag kann bei Bedarf mit jedem Flag aus der Gruppe 1 |
| 395 | 395 |
kombiniert werden. |
| 396 |
|
|
| 396 |
|
|
| 397 | 397 |
SM2_ESCAPE Wendet htmlspecialchars auf den Menüstring an. |
| 398 | 398 |
Dies kann bei älteren Websitebaker Installationen erforderlich |
| 399 | 399 |
sein um eine valide HTML Ausgabe zu erzeugen. |
| 400 |
|
|
| 401 |
SM2_SHOWHIDDEN Hidden pages are usually hidden all of the time, including
|
|
| 400 |
|
|
| 401 |
SM2_SHOWHIDDEN Hidden pages are usually hidden all of the time, including |
|
| 402 | 402 |
when they are active (i.e. current page or a parent page). |
| 403 | 403 |
Use private pages for time when you want pages to be |
| 404 | 404 |
hidden except when active. However for compatibility with |
| ... | ... | |
| 418 | 418 |
Für diesen Parameter gibt es auch einen erweiterten Modus, bei dem die Optionen |
| 419 | 419 |
als assoziatives Array übergeben werden. Näheres dazu im Abschnitt ERWEITERTE |
| 420 | 420 |
OPTIONEN. Für die meisten Anwendungsfälle wird dies jedoch NICHT benötigt. |
| 421 |
|
|
| 421 |
|
|
| 422 | 422 |
$aItemOpen |
| 423 | 423 |
Dies legt den Formatstring fest, mit dem jeder einzelne Menüeintrag begonnen |
| 424 | 424 |
wird. Für den allerersten Menüeintrag kann mittels $aTopItemOpen ein anderer |
| ... | ... | |
| 426 | 426 |
Wenn dieser Parameter auf false gesetzt wird, wird der Vorgabe Formatstring |
| 427 | 427 |
'[li][a][menu_title]</a>' verwendet um die Kompatibilität zur Website Baker |
| 428 | 428 |
Standardfunktion show_menu() zu gewährleisten. |
| 429 |
Da die Formatierung mittels CSS-Klassen oftmals einfacher ist, wenn sie auf den
|
|
| 429 |
Da die Formatierung mittels CSS-Klassen oftmals einfacher ist, wenn sie auf den |
|
| 430 | 430 |
<a> tag angewendet werden, empfiehlt es sich hier folgenden Formatstring zu |
| 431 | 431 |
verwenden: '<li>[ac][menu_title]</a>'. |
| 432 |
|
|
| 432 |
|
|
| 433 | 433 |
Dieser Parameter kann auch als Instanz eine Formatierungklasse für das Menü |
| 434 |
verwendet werden. Die nähere Beschreibung dazu findet sich im Abschnitt FORMATTER.
|
|
| 434 |
verwendet werden. Die nähere Beschreibung dazu findet sich im Abschnitt FORMATTER. |
|
| 435 | 435 |
Wenn hier ein Formatter angegeben wird, werden alle Argumente |
| 436 | 436 |
nach $aItemOpen ignoriert. |
| 437 | 437 |
|
| 438 | 438 |
$aItemClose |
| 439 |
Dieser String schließt jeden Menüpunkt ab.
|
|
| 439 |
Dieser String schließt jeden Menüpunkt ab. |
|
| 440 | 440 |
Bitte beachten: dies ist kein Formatstring und es werden keine Schlüsselworte |
| 441 | 441 |
ersetzt! |
| 442 | 442 |
Wenn dieser Parameter auf false gesetzt ist, wird die Vorgabe '</li>' verwendet. |
| 443 |
|
|
| 443 |
|
|
| 444 | 444 |
$aMenuOpen |
| 445 | 445 |
Mit diesem Formatstring wird eine Liste von Menüeinträgen geöffnet. Für das erste |
| 446 | 446 |
Menü kann mittels $aTopMenuOpen ein davon abweichender Formatstring definiert |
| 447 | 447 |
werden. |
| 448 | 448 |
Wenn dieser Parameter auf false gesetzt ist wird der Vorgabewert '[ul]' |
| 449 | 449 |
verwendet. |
| 450 |
|
|
| 450 |
|
|
| 451 | 451 |
$aMenuClose |
| 452 |
Dieser String schließt jedes Menü ab.
|
|
| 452 |
Dieser String schließt jedes Menü ab. |
|
| 453 | 453 |
Bitte beachten: dies ist kein Formatstring und es werden keine Schlüsselworte |
| 454 | 454 |
ersetzt! |
| 455 | 455 |
Wenn dieser Parameter auf false gesetzt ist, wird die Vorgabe '</ul>' verwendet. |
| ... | ... | |
| 458 | 458 |
Der Formatstring für den allerersten Menüpunkt. Wenn dieser Parameter auf false |
| 459 | 459 |
gesetzt wird, wird der selbe Formatstring wie bei $aItemOpen verwendet. |
| 460 | 460 |
|
| 461 |
$aTopMenuOpen
|
|
| 461 |
$aTopMenuOpen |
|
| 462 | 462 |
Der Formatstring für das erste Menü. Wenn dieser Parameter auf false |
| 463 | 463 |
gesetzt wird, wird der selbe Formatstring wie bei $aMenuOpen verwendet. |
| 464 | 464 |
|
| 465 |
|
|
| 466 | 465 |
|
| 466 |
|
|
| 467 | 467 |
ERWEITERTE OPTIONEN |
| 468 | 468 |
=================== |
| 469 |
Der Parameter $aOptions kann auf zweierlei Arten verwendet werden. Zum einen, wie oben
|
|
| 470 |
im Abschnitt PARAMETER beschrieben, diese Art sollte für die allermeisten
|
|
| 471 |
Anwendungsfälle ausreichen. Um allerdings in speziellen Fällen die Sonderoptionen
|
|
| 472 |
ansprechen zu können, müssen die erforderlichen Werte als assoziatives Array
|
|
| 469 |
Der Parameter $aOptions kann auf zweierlei Arten verwendet werden. Zum einen, wie oben |
|
| 470 |
im Abschnitt PARAMETER beschrieben, diese Art sollte für die allermeisten |
|
| 471 |
Anwendungsfälle ausreichen. Um allerdings in speziellen Fällen die Sonderoptionen |
|
| 472 |
ansprechen zu können, müssen die erforderlichen Werte als assoziatives Array |
|
| 473 | 473 |
bereitgestellt werden. |
| 474 |
Bitte beachten: Die SM2_* Flags sind auch hierbei erforderlich und müßen als 'flags'
|
|
| 474 |
Bitte beachten: Die SM2_* Flags sind auch hierbei erforderlich und müßen als 'flags' |
|
| 475 | 475 |
übergeben werden. |
| 476 | 476 |
|
| 477 |
'flags' **ZWINGEND ERFORDELICH** Dies sind die Flags die oben im Abschnitt
|
|
| 477 |
'flags' **ZWINGEND ERFORDELICH** Dies sind die Flags die oben im Abschnitt |
|
| 478 | 478 |
PARAMETER unter $aOptions beschrieben wurden. |
| 479 | 479 |
|
| 480 |
'notrim' Hiermit wird eine Anzahl von Ebenen festegelegt, die relativ bezogen
|
|
| 481 |
auf die in $aStart festgelegte Menüebene, immer angezeigt werden. Dies
|
|
| 480 |
'notrim' Hiermit wird eine Anzahl von Ebenen festegelegt, die relativ bezogen |
|
| 481 |
auf die in $aStart festgelegte Menüebene, immer angezeigt werden. Dies |
|
| 482 | 482 |
bewirkt, daß für diese Ebenen das SM2_TRIM Flag ignoriert wird. |
| 483 | 483 |
|
| 484 |
Um dieses Array zu verwenden, empfiehlt es sich es erst anzulegen und dann den
|
|
| 484 |
Um dieses Array zu verwenden, empfiehlt es sich es erst anzulegen und dann den |
|
| 485 | 485 |
$aOptions parameter mit dem angelegten Array zu beliefern: |
| 486 | 486 |
|
| 487 | 487 |
$options = array('flags' => (SM2_TRIM|...), 'notrim' => 1);
|
| 488 | 488 |
show_menu2(0, SM2_ROOT, SM2_CURR+1, $options); |
| 489 |
|
|
| 490 |
|
|
| 491 |
|
|
| 489 |
|
|
| 490 |
|
|
| 491 |
|
|
| 492 | 492 |
FORMAT STRINGS |
| 493 | 493 |
============== |
| 494 | 494 |
Die folgenden Tags können in den Formatstrings für $aItemOpen und $aMenuOpen |
| ... | ... | |
| 499 | 499 |
[li] <li> tag mit Klasse: '<li class="[class]">' |
| 500 | 500 |
[ul] <ul> tag mit Klasse: '<ul class="[class]">' |
| 501 | 501 |
[class] Liste der Klassen für diese Seite |
| 502 |
[menu_title] Text des Menütitel
|
|
| 502 |
[menu_title] Text des Menütitel |
|
| 503 | 503 |
(HTML entity escaped ausser das SM2_NOESCAPE Flag ist gesetzt) |
| 504 | 504 |
[menu_icon_0] die URL zu einer Bilddatei mit normal - Darstellung (ab WB2.8.4) |
| 505 | 505 |
[menu_icon_1] die URL zu einer Bilddatei mit active/hover - Darstellung (ab WB2.8.4) |
| 506 |
[page_title] text des Seitentitel
|
|
| 506 |
[page_title] text des Seitentitel |
|
| 507 | 507 |
(HTML entity escaped ausser das SM2_NOESCAPE Flag ist gesetzt) |
| 508 | 508 |
[page_icon] die URL zu einer seitenbezogenen Bilddatei (ab WB2.8.4) |
| 509 | 509 |
[tooltip] Tooltip-Text, der normal im title-Attribut der Links ausgegeben wird (ab WB2.8.4) |
| ... | ... | |
| 511 | 511 |
[target] das Seitenziel für den <a> tag |
| 512 | 512 |
[page_id] die Page ID des aktuellen Menüpunktes. |
| 513 | 513 |
[parent] die Page ID des übergeordneten Menüpunktes. |
| 514 |
[level] die Seitenebene,
|
|
| 514 |
[level] die Seitenebene, |
|
| 515 | 515 |
dies ist die gleiche Zahl die im "menu-N" CSS tag verwendet wird. |
| 516 | 516 |
[sib] Anzahl der Geschwister des aktuellen Menüpunktes. |
| 517 | 517 |
[sibCount] Anzahl aller Geschwister in diesem Menü. |
| ... | ... | |
| 530 | 530 |
|
| 531 | 531 |
[if(A){B}]
|
| 532 | 532 |
[if(A){B}else{C}]
|
| 533 |
|
|
| 533 |
|
|
| 534 | 534 |
A Die Bedingung. Details dazu, siehe unten. |
| 535 |
|
|
| 535 |
|
|
| 536 | 536 |
B Der Ausdruck der verwendet wird, wenn die Bedingung erfüllt ist. |
| 537 | 537 |
Dies kann ein beliebiger String sein, der jedoch nicht das Zeichen '}' |
| 538 | 538 |
enthalten darf. Er kann jeden beliebigen Formatstring aus dem Abschnitt |
| 539 |
'Format Strings' enthalten, jedoch keinen weiteren Bedingungstest (da das
|
|
| 539 |
'Format Strings' enthalten, jedoch keinen weiteren Bedingungstest (da das |
|
| 540 | 540 |
Zeichen '}' nicht erlaubt ist). |
| 541 |
|
|
| 541 |
|
|
| 542 | 542 |
C Der Ausdruck der verwendet wird, wenn die Bedingung nicht erfüllt ist. |
| 543 | 543 |
Dies kann ein beliebiger String sein, der jedoch nicht das Zeichen '}' |
| 544 | 544 |
enthalten darf. Er kann jeden beliebigen Formatstring aus dem Abschnitt |
| 545 |
'Format Strings' enthalten, jedoch keinen weiteren Bedingungstest (da das
|
|
| 545 |
'Format Strings' enthalten, jedoch keinen weiteren Bedingungstest (da das |
|
| 546 | 546 |
Zeichen '}' nicht erlaubt ist). |
| 547 | 547 |
|
| 548 | 548 |
Die Bedingung ist eine Kombination von einem oder mehreren boolschen Vergleichen. |
| 549 | 549 |
Wenn mehr als ein Vergleich erforderlich ist, so muss dieser mit den anderen Vergleichen |
| 550 |
mittels || (boolsches oder - OR) oder && (boolsches und - AND) verknüpft werden.
|
|
| 550 |
mittels || (boolsches oder - OR) oder && (boolsches und - AND) verknüpft werden. |
|
| 551 | 551 |
|
| 552 |
Ein einzelner Vergleich besteht aus dem linken Operanden, dem Operator und dem rechten
|
|
| 552 |
Ein einzelner Vergleich besteht aus dem linken Operanden, dem Operator und dem rechten |
|
| 553 | 553 |
Operanden. |
| 554 | 554 |
z.B. X == Y - hierbei ist X der linke Operand, == der Operator und Y der rechte Operand. |
| 555 |
|
|
| 555 |
|
|
| 556 | 556 |
Linker Operand. Muss eines der folgende Schlüsselworte sein: |
| 557 | 557 |
class Überprüfung ob diese Klasse existiert. Es sind nur die |
| 558 | 558 |
"==" and "!=" Operatoren erlaubt. In diesem Fall haben die Operatoren |
| ... | ... | |
| 563 | 563 |
sibCount Überprüfung der Geamtanzahl der Geschwister im aktuellen Menü. |
| 564 | 564 |
id Überprüfung der page id. |
| 565 | 565 |
target Überprüfung der Target-Angabe |
| 566 |
|
|
| 566 |
|
|
| 567 | 567 |
Operator. Muss einer der folgenden sein: |
| 568 | 568 |
< Kleiner als |
| 569 | 569 |
<= Kleiner oder gleich als |
| ... | ... | |
| 571 | 571 |
!= Nicht gleich |
| 572 | 572 |
>= Grössr oder gleich als |
| 573 | 573 |
> Grösser als |
| 574 |
|
|
| 574 |
|
|
| 575 | 575 |
Rechter Operand. Die Art dieses Operanden hängt von dem, für den linken Operanden |
| 576 | 576 |
verwendeten Schlüsselwort ab. |
| 577 | 577 |
class einer der "menu-*" Klassennamen wie sie im Abschnitt "Ausgabe" |
| ... | ... | |
| 591 | 591 |
Geschwister in diesem Menü zu überprüfen |
| 592 | 592 |
sibCount Eine positive Integerzahl |
| 593 | 593 |
target Ein String, der eine mögliche Targetangabe darstellt |
| 594 |
|
|
| 594 |
|
|
| 595 | 595 |
Folgende Beispiele ergeben "wahr" und der Ausdruck {exp} wird ausgeführt, wenn zutrifft:
|
| 596 |
|
|
| 596 |
|
|
| 597 | 597 |
[if(class==menu-expand){exp}] hat ein Untermenü
|
| 598 | 598 |
[if(class==menu-first){exp}] ist der erste Eintrag in einem Menü
|
| 599 | 599 |
[if(class!=menu-first){exp}] ist NICHT der erste Eintrag in einem Menü
|
| ... | ... | |
| 603 | 603 |
[if(sib==2){exp}] ist der zweite Eintrag in einem Menü
|
| 604 | 604 |
[if(sibCount>1){exp}] ist in einem Menü mit mehr als einem Eintrag
|
| 605 | 605 |
[if(sibCount!=2){exp}] ist in einem Menü, das nicht genau 2 Einträge hat
|
| 606 |
[if(level>parent){exp}] ist in einem Geschwistermenü oder dem Untermenü eines
|
|
| 606 |
[if(level>parent){exp}] ist in einem Geschwistermenü oder dem Untermenü eines
|
|
| 607 | 607 |
Geschwistermenüs |
| 608 | 608 |
[if(id==parent){exp}] ist der übergeordnete Punkt der aktuellen id
|
| 609 | 609 |
[if(target==_self){exp}] im Target-Attribut ist der String '_self' enthalten
|
| 610 | 610 |
|
| 611 |
Wenn eine sonst-Klausel (else) hinzugefügt wird, so wird diese in allen anderen Fällen
|
|
| 611 |
Wenn eine sonst-Klausel (else) hinzugefügt wird, so wird diese in allen anderen Fällen |
|
| 612 | 612 |
ausgeführt. |
| 613 | 613 |
Zum Beispiel wird "foo" immer dann ausgeführt, wenn die if Überprüfung falsch ergibt, also: |
| 614 | 614 |
|
| ... | ... | |
| 617 | 617 |
|
| 618 | 618 |
Bei mehrfach Vergleichen wird der Ausdruck "exp" nur ausgeführt, wenn: |
| 619 | 619 |
|
| 620 |
[if(sib == 1 || sib > 3){exp}] ist der erste Eintrag ODER ist der vierte oder höhere
|
|
| 621 |
Eintrag im Menü
|
|
| 622 |
|
|
| 623 |
[if(id == current && class == menu-expand){exp} ist der aktuelle Eintrag UND hat
|
|
| 620 |
[if(sib == 1 || sib > 3){exp}] ist der erste Eintrag ODER ist der vierte oder höhere
|
|
| 621 |
Eintrag im Menü |
|
| 622 |
|
|
| 623 |
[if(id == current && class == menu-expand){exp} ist der aktuelle Eintrag UND hat
|
|
| 624 | 624 |
Untermenüs |
| 625 |
|
|
| 625 |
|
|
| 626 | 626 |
Bitte beachten: |
| 627 | 627 |
Alle Überprüfungen werden in der Reihenfolge ausgeführt, in der sie notiert sind, denn: |
| 628 | 628 |
* es findet keine Überprüfung auf evtl. Schleifen statt (alle Überprüfungen werden immer ausgeführt) |
| ... | ... | |
| 647 | 647 |
{
|
| 648 | 648 |
// called once before any menu is processed to allow object initialization |
| 649 | 649 |
function initialize() { }
|
| 650 |
|
|
| 650 |
|
|
| 651 | 651 |
// called to open the menu list |
| 652 | 652 |
function startList($aPage, $aUrl) { }
|
| 653 |
|
|
| 653 |
|
|
| 654 | 654 |
// called to open the menu item |
| 655 | 655 |
function startItem($aPage, $aUrl, $aCurrSib, $aSibCount) { }
|
| 656 |
|
|
| 656 |
|
|
| 657 | 657 |
// called to close the menu item |
| 658 | 658 |
function finishItem() { }
|
| 659 |
|
|
| 659 |
|
|
| 660 | 660 |
// called to close the menu list |
| 661 | 661 |
function finishList() { }
|
| 662 |
|
|
| 662 |
|
|
| 663 | 663 |
// called once after all menu has been processed to allow object finalization |
| 664 | 664 |
function finalize() { }
|
| 665 |
|
|
| 665 |
|
|
| 666 | 666 |
// called once after finalize() if the SM2_NOOUTPUT flag is used |
| 667 | 667 |
function getOutput() { }
|
| 668 | 668 |
}; |
| branches/2.8.x/wb/modules/show_menu2/README.en.txt | ||
|---|---|---|
| 1 | 1 |
show_menu2, version 4.9 |
| 2 | 2 |
======================= |
| 3 |
A code snippet for the Website Baker CMS software. It provides a complete
|
|
| 4 |
replacement for the builtin menu functions. All menu data is retrieved using
|
|
| 5 |
a single database query, all types of menu styles (lists, breadcrums, sitemaps)
|
|
| 3 |
A code snippet for the Website Baker CMS software. It provides a complete |
|
| 4 |
replacement for the builtin menu functions. All menu data is retrieved using |
|
| 5 |
a single database query, all types of menu styles (lists, breadcrums, sitemaps) |
|
| 6 | 6 |
can be generated with extensive customisation of the resulting HTML. |
| 7 | 7 |
|
| 8 | 8 |
|
| ... | ... | |
| 16 | 16 |
the "Uninstall Module" list and choose the "Uninstall" button. |
| 17 | 17 |
5. In the "Install Module" section, enter the path to the show_menu2 zip file |
| 18 | 18 |
that you downloaded in step 1, and choose the "Install" button. |
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
|
| 22 | 22 |
USING SHOW_MENU2 |
| 23 | 23 |
================ |
| 24 |
You need to modify the PHP files of your template to call show_menu2 where you
|
|
| 24 |
You need to modify the PHP files of your template to call show_menu2 where you |
|
| 25 | 25 |
wish to have the menu displayed. Remember when you replace calls to the old |
| 26 |
menu functions to use the new parameters that show_menu2 requires.
|
|
| 26 |
menu functions to use the new parameters that show_menu2 requires. |
|
| 27 | 27 |
|
| 28 | 28 |
Often times the default menu generated by show_menu2 is all that you need. |
| 29 | 29 |
This menu shows the current page and children of the current page. It is |
| 30 | 30 |
generated by just calling show_menu2 with no parameters. For example: |
| 31 | 31 |
|
| 32 | 32 |
show_menu2(); |
| 33 |
|
|
| 33 |
|
|
| 34 | 34 |
Note that the call to show_menu2 is PHP, so you usually need to wrap it in the |
| 35 | 35 |
PHP code brackets so that it will execute. Like this: |
| 36 | 36 |
|
| ... | ... | |
| 39 | 39 |
This default menu generates a complete list based menu with many classes that |
| 40 | 40 |
allow easy CSS styling. For example, the current menu item will have the |
| 41 | 41 |
"menu-current" class added to the <li> tag. Additionally, every menu item with |
| 42 |
a sub-menu will have the "menu-expand" class added to the <li> tag. This allows
|
|
| 42 |
a sub-menu will have the "menu-expand" class added to the <li> tag. This allows |
|
| 43 | 43 |
you to create CSS rules to style those menu items differently. For example: |
| 44 | 44 |
|
| 45 | 45 |
li.menu-expand { font-weight: bold; }
|
| 46 | 46 |
li.menu-current { background: red; }
|
| 47 | 47 |
|
| 48 |
See the "Output" section for details of exactly what classes are added to each
|
|
| 49 |
element. More elaborate and different menu structures are able to be created by
|
|
| 50 |
supplying different parameters to the show_menu2 function call. For example,
|
|
| 48 |
See the "Output" section for details of exactly what classes are added to each |
|
| 49 |
element. More elaborate and different menu structures are able to be created by |
|
| 50 |
supplying different parameters to the show_menu2 function call. For example, |
|
| 51 | 51 |
to show only menu items from the top level of the menu you use: |
| 52 | 52 |
|
| 53 | 53 |
show_menu2(0, SM2_ROOT, SM2_START); |
| 54 |
|
|
| 54 |
|
|
| 55 | 55 |
Alternatively, to show up to two levels of the child menus of the current page: |
| 56 | 56 |
|
| 57 | 57 |
show_menu2(0, SM2_CURR+1, SM2_CURR+2); |
| 58 | 58 |
|
| 59 | 59 |
There are many more possible menus that can be generated by show_menu2. See the |
| 60 |
demonstration website at http://code.jellycan.com/sm2test/ for more examples.
|
|
| 60 |
demonstration website at http://code.jellycan.com/sm2test/ for more examples. |
|
| 61 | 61 |
|
| 62 | 62 |
|
| 63 | 63 |
|
| 64 | 64 |
COMMON QUESTIONS |
| 65 | 65 |
================ |
| 66 | 66 |
|
| 67 |
Q: I'm not a programmer. Do you have simpler documentation?
|
|
| 67 |
Q: I'm not a programmer. Do you have simpler documentation? |
|
| 68 | 68 |
A: Nup. This is it. Go hard. Gambarre. |
| 69 | 69 |
|
| 70 | 70 |
|
| 71 | 71 |
Q: How do I create a drop-down menu? |
| 72 |
A: This is unrelated to show_menu2. You need to change the template CSS code
|
|
| 72 |
A: This is unrelated to show_menu2. You need to change the template CSS code |
|
| 73 | 73 |
to display the menu as a drop-down. Try the "allcss2" template from the WB |
| 74 |
addon repository. http://addons.websitebaker.org/pages/templates.php
|
|
| 74 |
addon repository. http://addons.websitebaker.org/ |
|
| 75 | 75 |
|
| 76 | 76 |
|
| 77 | 77 |
Q: Why does the menu disappear after I do a search on my multilingual WB site? |
| 78 | 78 |
A: You're missing some required lines in your template. |
| 79 | 79 |
|
| 80 |
1. Log into WB administration, and go to Settings -> Show advanced settings
|
|
| 81 |
-> Search Settings -> Header Code and add the following input field
|
|
| 82 |
after the <form> open tag:
|
|
| 80 |
1. Log into WB administration, and go to Settings -> Show advanced settings |
|
| 81 |
-> Search Settings -> Header Code and add the following input field |
|
| 82 |
after the <form> open tag: |
|
| 83 | 83 |
|
| 84 | 84 |
<input type="hidden" name="referrer" value="[REFERRER_ID]" /> |
| 85 | 85 |
|
| 86 | 86 |
|
| 87 |
2. In the index.php of your template, add the following input field
|
|
| 87 |
2. In the index.php of your template, add the following input field |
|
| 88 | 88 |
immediately following the search <form> open tag. |
| 89 | 89 |
|
| 90 | 90 |
<input type="hidden" name="referrer" value="<?php echo defined('REFERRER_ID')?REFERRER_ID:PAGE_ID;?>" />
|
| 91 | 91 |
|
| 92 | 92 |
|
| 93 | 93 |
Q: Multilingual? That sounds cool. How do I do that? |
| 94 |
A: http://help.websitebaker.org/pages/en/advanced-docu.php
|
|
| 94 |
A: http://www.websitebaker2.org/en/help/designer-guide/multilingual-websites.php
|
|
| 95 | 95 |
|
| 96 | 96 |
|
| 97 | 97 |
Q: SM2 is generating a warning every time the page is accessed: |
| 98 | 98 |
"show_menu2 error: $aOptions is invalid. No flags from group 1 supplied!" |
| 99 |
A: You are passing the wrong values to the function. Have a closer look at the
|
|
| 100 |
parameters that you are passing. See the PARAMETERS section below for the
|
|
| 99 |
A: You are passing the wrong values to the function. Have a closer look at the |
|
| 100 |
parameters that you are passing. See the PARAMETERS section below for the |
|
| 101 | 101 |
correct flag values to pass for the $aOptions parameter. |
| 102 | 102 |
|
| 103 | 103 |
|
| 104 | 104 |
Q: How do I use a different class/picture/color/widget for each entry in a menu? |
| 105 |
A: Use the [page_id] format string in the $aItemOpen string. Create a unique
|
|
| 105 |
A: Use the [page_id] format string in the $aItemOpen string. Create a unique |
|
| 106 | 106 |
class or id for each menu item, then reference that item in your CSS or Javascript |
| 107 | 107 |
to do whatever you want. |
| 108 |
|
|
| 108 |
|
|
| 109 | 109 |
To add a unique class for each menu item (or similar): |
| 110 |
|
|
| 110 |
|
|
| 111 | 111 |
"<li><a href="[url]" target="[target]" class="[class] p[page_id]">[menu_title]</a>" |
| 112 | 112 |
|
| 113 | 113 |
... creating menu items like ... |
| 114 |
|
|
| 114 |
|
|
| 115 | 115 |
<li><a href="/pages/foo/bar.php" target="_top" class="menu-top p45">Top Menu</a> |
| 116 | 116 |
|
| 117 | 117 |
Reference this in your CSS like: |
| 118 |
|
|
| 118 |
|
|
| 119 | 119 |
a.p45 { color: red; }
|
| 120 |
|
|
| 120 |
|
|
| 121 | 121 |
To add a unique ID for each menu item (or similar): |
| 122 |
|
|
| 122 |
|
|
| 123 | 123 |
"<li><a id="p[page_id]" href="[url]" target="[target]" class="[class]">[menu_title]</a>" |
| 124 |
|
|
| 124 |
|
|
| 125 | 125 |
... creating menu items like ... |
| 126 |
|
|
| 126 |
|
|
| 127 | 127 |
<li><a id="p45" href="/pages/foo/bar.php" target="_top" class="menu-top">Top Menu</a> |
| 128 | 128 |
|
| 129 | 129 |
Reference this in your CSS like: |
| 130 |
|
|
| 130 |
|
|
| 131 | 131 |
a#p45 { color: red; }
|
| 132 |
|
|
| 132 |
|
|
| 133 | 133 |
Note that the ID can only be used if that menu is generated and displayed one time |
| 134 |
only on the page (because HTML ID's must be unique within a page). |
|
| 135 |
|
|
| 134 |
only on the page (because HTML ID's must be unique within a page). |
|
| 136 | 135 |
|
| 137 | 136 |
|
| 137 |
|
|
| 138 | 138 |
FUNCTION |
| 139 | 139 |
======== |
| 140 | 140 |
|
| ... | ... | |
| 157 | 157 |
Ensure that you use each parameter correctly. Use the following rules: |
| 158 | 158 |
|
| 159 | 159 |
$aMenu will be 0 for most people. |
| 160 |
|
|
| 160 |
|
|
| 161 | 161 |
$aStart must be either a page ID or a value starting with "SM2_". |
| 162 |
|
|
| 162 |
|
|
| 163 | 163 |
$aMaxLevel must be only values that start with "SM2_". |
| 164 |
|
|
| 165 |
$aOptions must be only values that start with "SM2_" (unless you are
|
|
| 164 |
|
|
| 165 |
$aOptions must be only values that start with "SM2_" (unless you are |
|
| 166 | 166 |
in a very small minority of users). |
| 167 |
|
|
| 168 |
All other parameters are the HTML tag templates that will be
|
|
| 167 |
|
|
| 168 |
All other parameters are the HTML tag templates that will be |
|
| 169 | 169 |
output for menus and menu items. |
| 170 |
|
|
| 171 |
Note that every parameter from $aItemOpen can be supplied as false to get
|
|
| 170 |
|
|
| 171 |
Note that every parameter from $aItemOpen can be supplied as false to get |
|
| 172 | 172 |
the default value. |
| 173 | 173 |
|
| 174 | 174 |
|
| 175 | 175 |
|
| 176 | 176 |
HTML OUTPUT |
| 177 | 177 |
=========== |
| 178 |
The menu is output differently depending on what parameters have been
|
|
| 179 |
supplied to the function, however in general the following classes are used
|
|
| 178 |
The menu is output differently depending on what parameters have been |
|
| 179 |
supplied to the function, however in general the following classes are used |
|
| 180 | 180 |
for each menu. Note that items will have multiple classes when relevant. |
| 181 | 181 |
|
| 182 | 182 |
CLASS ATTACHED TO |
| ... | ... | |
| 192 | 192 |
|
| 193 | 193 |
The following classes are added only if SM2_NUMCLASS flag has been used. |
| 194 | 194 |
|
| 195 |
menu-N Every menu item. The N is replaced with the ABSOLUTE
|
|
| 196 |
menu depth of the item starting with 0. The root level
|
|
| 195 |
menu-N Every menu item. The N is replaced with the ABSOLUTE |
|
| 196 |
menu depth of the item starting with 0. The root level |
|
| 197 | 197 |
menu is always menu-0, the next level is menu-1, etc. |
| 198 |
menu-child-N Every sub-menu of the current page, the N is replaced
|
|
| 198 |
menu-child-N Every sub-menu of the current page, the N is replaced |
|
| 199 | 199 |
with the relative depth of the submenu starting at 0. |
| 200 | 200 |
|
| 201 | 201 |
|
| ... | ... | |
| 240 | 240 |
|
| 241 | 241 |
PARAMETERS |
| 242 | 242 |
========== |
| 243 |
$aMenu
|
|
| 244 |
Menu number to use. This is useful when you are using multiple menus.
|
|
| 245 |
Supplying a menu number of 0 will use the default menu for the current
|
|
| 243 |
$aMenu |
|
| 244 |
Menu number to use. This is useful when you are using multiple menus. |
|
| 245 |
Supplying a menu number of 0 will use the default menu for the current |
|
| 246 | 246 |
page. Supplying SM2_ALLMENU will return all menus in the system. |
| 247 | 247 |
|
| 248 |
$aStart
|
|
| 248 |
$aStart |
|
| 249 | 249 |
Specify where the menu generation should start from. This is most |
| 250 |
times the parent item of the menu to display. It must be one of the
|
|
| 250 |
times the parent item of the menu to display. It must be one of the |
|
| 251 | 251 |
following values: |
| 252 | 252 |
SM2_ROOT+N Start N levels down from the root. e.g. |
| 253 |
SM2_ROOT Starting at the root menu
|
|
| 253 |
SM2_ROOT Starting at the root menu |
|
| 254 | 254 |
SM2_ROOT+1 Start 1 level below the root |
| 255 | 255 |
SM2_ROOT+2 Start 2 levels below the root |
| 256 | 256 |
SM2_CURR+N Start N levels down from the current page level. e.g. |
| ... | ... | |
| 259 | 259 |
SM2_CURR+1 Starts 1 level down from the current |
| 260 | 260 |
page with the children menus. |
| 261 | 261 |
page_id Display using the specific page as the parent. All |
| 262 |
child menus of that page will be displayed. The
|
|
| 263 |
page_id can be found by editing the page in WB admin
|
|
| 264 |
interface. The page_id is included in the URL like:
|
|
| 262 |
child menus of that page will be displayed. The |
|
| 263 |
page_id can be found by editing the page in WB admin |
|
| 264 |
interface. The page_id is included in the URL like: |
|
| 265 | 265 |
http://SITE/admin/pages/modify.php?page_id=35 |
| 266 | 266 |
|
| 267 |
$aMaxLevel
|
|
| 267 |
$aMaxLevel |
|
| 268 | 268 |
Maximum menu level to display. Menus are displayed from the start |
| 269 | 269 |
level down to this level. |
| 270 | 270 |
SM2_ALL No limit, all levels are displayed |
| 271 |
SM2_CURR+N Always show to the current page + N levels.
|
|
| 271 |
SM2_CURR+N Always show to the current page + N levels. |
|
| 272 | 272 |
SM2_CURR Current (no children) |
| 273 | 273 |
SM2_CURR+3 All parents + current + 3 children |
| 274 | 274 |
SM2_START+N Always show from the starting level + N levels. The |
| ... | ... | |
| 276 | 276 |
what level the current page is. |
| 277 | 277 |
SM2_START Single level of menus from starting level |
| 278 | 278 |
SM2_START+1 Starting level and 1 level down |
| 279 |
SM2_MAX+N Show at most N levels from the starting level. Levels
|
|
| 279 |
SM2_MAX+N Show at most N levels from the starting level. Levels |
|
| 280 | 280 |
won't be shown if they are below the current level. |
| 281 | 281 |
SM2_MAX Starting level only (same as SM2_START) |
| 282 | 282 |
SM2_MAX+1 Maximum of starting level and 1 level. |
| 283 | 283 |
|
| 284 |
$aOptions
|
|
| 284 |
$aOptions |
|
| 285 | 285 |
Specify flags for different generation options for the menu. The flags |
| 286 | 286 |
may be combined together using bitwise OR (|). For example, to specify |
| 287 | 287 |
both TRIM and PRETTY you should use, (SM2_TRIM | SM2_PRETTY). |
| 288 | 288 |
|
| 289 | 289 |
GROUP 1 |
| 290 | 290 |
------- |
| 291 |
Exactly one flag from this group must always be supplied. These flags
|
|
| 292 |
affect how the siblings in the tree are removed from the output.
|
|
| 291 |
Exactly one flag from this group must always be supplied. These flags |
|
| 292 |
affect how the siblings in the tree are removed from the output. |
|
| 293 | 293 |
|
| 294 | 294 |
SM2_ALL Show all branches of the menu tree |
| 295 |
A-1 -> B-1
|
|
| 295 |
A-1 -> B-1 |
|
| 296 | 296 |
-> B-2 -> C-1 |
| 297 | 297 |
-> C-2 (CURRENT) |
| 298 | 298 |
-> D-1 |
| ... | ... | |
| 300 | 300 |
-> C-3 |
| 301 | 301 |
A-2 -> B-3 |
| 302 | 302 |
-> B-4 |
| 303 |
SM2_TRIM Show all sibling menus of pages on the current path.
|
|
| 304 |
All sub-menus of elements that are not on the path
|
|
| 303 |
SM2_TRIM Show all sibling menus of pages on the current path. |
|
| 304 |
All sub-menus of elements that are not on the path |
|
| 305 | 305 |
are removed. |
| 306 |
A-1 -> B-1
|
|
| 306 |
A-1 -> B-1 |
|
| 307 | 307 |
-> B-2 -> C-1 |
| 308 | 308 |
-> C-2 (CURRENT) |
| 309 | 309 |
-> D-1 |
| 310 | 310 |
-> D-2 |
| 311 | 311 |
-> C-3 |
| 312 |
A-2
|
|
| 312 |
A-2 |
|
| 313 | 313 |
SM2_CRUMB Show only the breadcrumb trail, i.e. the current |
| 314 | 314 |
menu and all of it's ancestor menus. |
| 315 | 315 |
A-1 -> B-2 -> C-2 (CURRENT) |
| 316 |
SM2_SIBLING The same as SM2_TRIM however only sibling menus of
|
|
| 317 |
the current page are displayed. All other menus are
|
|
| 316 |
SM2_SIBLING The same as SM2_TRIM however only sibling menus of |
|
| 317 |
the current page are displayed. All other menus are |
|
| 318 | 318 |
trimmed to show only the path. |
| 319 | 319 |
A-1 -> B-2 -> C-1 |
| 320 | 320 |
-> C-2 (CURRENT) |
| ... | ... | |
| 326 | 326 |
------- |
| 327 | 327 |
All of these flags are optional. Any number of them may be combined. |
| 328 | 328 |
|
| 329 |
SM2_NUMCLASS Add the numbered menu classes to the menu. If this
|
|
| 330 |
flag is supplied, the "menu-N" and "menu-child-N"
|
|
| 329 |
SM2_NUMCLASS Add the numbered menu classes to the menu. If this |
|
| 330 |
flag is supplied, the "menu-N" and "menu-child-N" |
|
| 331 | 331 |
classes will be added. |
| 332 |
|
|
| 332 |
|
|
| 333 | 333 |
SM2_ALLINFO Load all fields from the page table of the database. |
| 334 | 334 |
This will result in quite a lot of memory being used |
| 335 | 335 |
and is not recommended, however it will make keywords, |
| ... | ... | |
| 338 | 338 |
NOTE: This flag must be used on the *FIRST* call to |
| 339 | 339 |
show_menu2 *for this menu ID*, or in combination with |
| 340 | 340 |
SM2_NOCACHE otherwise it will have no effect. |
| 341 |
|
|
| 341 |
|
|
| 342 | 342 |
SM2_NOCACHE Do not reuse or store the data read from the database |
| 343 |
between calls to show_menu2.
|
|
| 344 |
|
|
| 343 |
between calls to show_menu2. |
|
| 344 |
|
|
| 345 | 345 |
SM2_PRETTY Pretty print the menu HTML with spacing and newlines |
| 346 | 346 |
for debugging purposes. |
| 347 |
|
|
| 348 |
SM2_BUFFER Do not output the menu HTML but instead buffer it
|
|
| 347 |
|
|
| 348 |
SM2_BUFFER Do not output the menu HTML but instead buffer it |
|
| 349 | 349 |
internally and return it as a string from show_menu2. |
| 350 |
|
|
| 351 |
SM2_CURRTREE Exclude all other top level menus from being considered.
|
|
| 350 |
|
|
| 351 |
SM2_CURRTREE Exclude all other top level menus from being considered. |
|
| 352 | 352 |
Only items in the current menu tree will be output. |
| 353 | 353 |
This can be combined with any of the Group 1 flags as |
| 354 | 354 |
necessary. |
| 355 |
|
|
| 355 |
|
|
| 356 | 356 |
SM2_ESCAPE Call htmlspecialchars on the menu strings. This may be |
| 357 | 357 |
required with older installations of WB. By escaping the |
| 358 |
raw database strings, it permits menus to have HTML
|
|
| 358 |
raw database strings, it permits menus to have HTML |
|
| 359 | 359 |
formatting in them that would cause otherwise cause |
| 360 |
pages to fail validation.
|
|
| 361 |
|
|
| 362 |
SM2_SHOWHIDDEN Hidden pages are usually hidden all of the time, including
|
|
| 360 |
pages to fail validation. |
|
| 361 |
|
|
| 362 |
SM2_SHOWHIDDEN Hidden pages are usually hidden all of the time, including |
|
| 363 | 363 |
when they are active (i.e. current page or a parent page). |
| 364 | 364 |
Use private pages for time when you want pages to be |
| 365 | 365 |
hidden except when active. However for compatibility with |
| ... | ... | |
| 372 | 372 |
SM2_NO_TITLE Supress the value of the 'title'-attributes on links which |
| 373 | 373 |
are created by [a] or [ac] formatted links. |
| 374 | 374 |
|
| 375 |
This parameter also has an extended mode where an associative array of
|
|
| 376 |
options is supplied. See the EXTENDED OPTIONS section for details.
|
|
| 375 |
This parameter also has an extended mode where an associative array of |
|
| 376 |
options is supplied. See the EXTENDED OPTIONS section for details. |
|
| 377 | 377 |
Most users will NOT need to use this. |
| 378 | 378 |
|
| 379 | 379 |
$aItemOpen |
| 380 | 380 |
Format string to use for creating each individual menu item entry. |
| 381 |
A different format string may be used for the very first entry by
|
|
| 382 |
supplying a different format string for $aTopItemOpen. When set to
|
|
| 381 |
A different format string may be used for the very first entry by |
|
| 382 |
supplying a different format string for $aTopItemOpen. When set to |
|
| 383 | 383 |
false, it uses the default of '[li][a][menu_title]</a>' to maintain |
| 384 | 384 |
compatibility with show_menu(). Note however that CSS formatting is |
| 385 | 385 |
often easier if the classes are added to the <a> tag. Use the format |
| 386 | 386 |
string of '<li>[ac][menu_title]</a>' for this style of tag. |
| 387 | 387 |
|
| 388 |
This parameter may also be specified as an instance of a formatting
|
|
| 388 |
This parameter may also be specified as an instance of a formatting |
|
| 389 | 389 |
class for the menu. See the section "Formatter" below for details of |
| 390 |
the API this class must expose. When a formatter is supplied, all
|
|
| 390 |
the API this class must expose. When a formatter is supplied, all |
|
| 391 | 391 |
arguments after $aItemOpen are ignored. |
| 392 | 392 |
|
| 393 | 393 |
$aItemClose |
| 394 | 394 |
String used to close each item. Note that this is not a format |
| 395 |
string and no keywords will be replaced. When set to false, it uses
|
|
| 395 |
string and no keywords will be replaced. When set to false, it uses |
|
| 396 | 396 |
the default of '</li>'. |
| 397 | 397 |
|
| 398 | 398 |
$aMenuOpen |
| 399 |
Format string to use for opening a list of menu item entries. A
|
|
| 400 |
different format string may be used for the very first menu by
|
|
| 401 |
supplying a different format string for $aTopMenuOpen. When set to
|
|
| 399 |
Format string to use for opening a list of menu item entries. A |
|
| 400 |
different format string may be used for the very first menu by |
|
| 401 |
supplying a different format string for $aTopMenuOpen. When set to |
|
| 402 | 402 |
false, it uses the default of '[ul]'. |
| 403 | 403 |
|
| 404 | 404 |
$aMenuClose |
| 405 | 405 |
String used to close each menu. Note that this is not a format |
| 406 |
string and no keywords will be replaced. When set to false, it uses
|
|
| 406 |
string and no keywords will be replaced. When set to false, it uses |
|
| 407 | 407 |
the default of '</ul>'. |
| 408 | 408 |
|
| 409 | 409 |
$aTopItemOpen |
| 410 |
Format string for the first item. When set to false, it uses the same
|
|
| 410 |
Format string for the first item. When set to false, it uses the same |
|
| 411 | 411 |
format as $aItemOpen. |
| 412 | 412 |
|
| 413 |
$aTopMenuOpen
|
|
| 414 |
Format string for the first menu. When set to false, it uses the same
|
|
| 413 |
$aTopMenuOpen |
|
| 414 |
Format string for the first menu. When set to false, it uses the same |
|
| 415 | 415 |
format as $aMenuOpen. |
| 416 | 416 |
|
| 417 | 417 |
|
| ... | ... | |
| 419 | 419 |
EXTENDED OPTIONS |
| 420 | 420 |
================ |
| 421 | 421 |
The $aOptions parameter is a dual mode parameter. For most users, only the |
| 422 |
SM2_* flags will be sufficient. However, to access the extra options, it
|
|
| 422 |
SM2_* flags will be sufficient. However, to access the extra options, it |
|
| 423 | 423 |
must be supplied as an associative array. Note that the SM2_* flags are |
| 424 | 424 |
still required and must be supplied as 'flags'. |
| 425 | 425 |
|
| 426 | 426 |
'flags' **REQUIRED** These are the flags described in PARAMETERS |
| 427 |
above for the $aOptions parameter.
|
|
| 427 |
above for the $aOptions parameter. |
|
| 428 | 428 |
|
| 429 |
'notrim' Specify a number of levels relative to the menu level of
|
|
| 429 |
'notrim' Specify a number of levels relative to the menu level of |
|
| 430 | 430 |
$aStart that will always be displayed. This will cause the |
| 431 | 431 |
SM2_TRIM flag to be ignored for these levels. |
| 432 |
|
|
| 433 |
To supply one of these options in addition to the flags, the option array
|
|
| 432 |
|
|
| 433 |
To supply one of these options in addition to the flags, the option array |
|
| 434 | 434 |
should be created and passed as the $aOptions parameter: |
| 435 | 435 |
|
| 436 | 436 |
$options = array('flags' => (SM2_TRIM|...), 'notrim' => 1);
|
| 437 | 437 |
show_menu2(0, SM2_ROOT, SM2_CURR+1, $options); |
| 438 |
|
|
| 439 |
|
|
| 440 |
|
|
| 438 |
|
|
| 439 |
|
|
| 440 |
|
|
| 441 | 441 |
FORMAT STRINGS |
| 442 | 442 |
============== |
| 443 |
The following tags may be included in the format strings for $aItemOpen and
|
|
| 443 |
The following tags may be included in the format strings for $aItemOpen and |
|
| 444 | 444 |
$aMenuOpen and will be replaced with the appropriate text. |
| 445 | 445 |
|
| 446 | 446 |
[a] <a> tag (no class): '<a href="[url]" target="[target]">' |
| ... | ... | |
| 476 | 476 |
|
| 477 | 477 |
[if(A){B}]
|
| 478 | 478 |
[if(A){B}else{C}]
|
| 479 |
|
|
| 479 |
|
|
| 480 | 480 |
A Conditional test. See below for more details. |
| 481 |
|
|
| 482 |
B Expression emitted when the if-test is true. This may be any string
|
|
| 483 |
that does NOT include the '}' character. It may include any of the
|
|
| 484 |
format strings described in the section FORMAT STRINGS with the
|
|
| 481 |
|
|
| 482 |
B Expression emitted when the if-test is true. This may be any string |
|
| 483 |
that does NOT include the '}' character. It may include any of the |
|
| 484 |
format strings described in the section FORMAT STRINGS with the |
|
| 485 | 485 |
exception of the conditional test (because '}' is not permitted). |
| 486 |
|
|
| 487 |
C Expression emitted when the if-test is false. This may be any string
|
|
| 488 |
that does NOT include the '}' character. It may include any of the
|
|
| 489 |
format strings described in the section FORMAT STRINGS with the
|
|
| 486 |
|
|
| 487 |
C Expression emitted when the if-test is false. This may be any string |
|
| 488 |
that does NOT include the '}' character. It may include any of the |
|
| 489 |
format strings described in the section FORMAT STRINGS with the |
|
| 490 | 490 |
exception of the conditional test (because '}' is not permitted). |
| 491 |
|
|
| 491 |
|
|
| 492 | 492 |
The conditional test is a combination of one or more boolean tests. |
| 493 | 493 |
If more than one test is supplied, it must be combined with other tests |
| 494 |
using either || (boolean OR) or && (boolean AND).
|
|
| 494 |
using either || (boolean OR) or && (boolean AND). |
|
| 495 | 495 |
|
| 496 | 496 |
A single test is made up of the left operand, operator and right operand. |
| 497 | 497 |
e.g. X == Y where X is the left operand, == is the operator and Y is the |
| 498 | 498 |
right operand. |
| 499 |
|
|
| 499 |
|
|
| 500 | 500 |
Left operand. It must be one of the following keywords: |
| 501 | 501 |
class Test for existence of one of the classes. Only the |
| 502 | 502 |
"==" and "!=" operators are permitted. In this case |
| 503 |
these operators have the meaning of "includes"
|
|
| 503 |
these operators have the meaning of "includes" |
|
| 504 | 504 |
instead of "equals". |
| 505 | 505 |
level Test against the page level. |
| 506 | 506 |
sib Test against the current page sibling number. |
| 507 | 507 |
sibCount Test against the number of siblings in the menu. |
| 508 | 508 |
id Test against the page id. |
| 509 | 509 |
target Test against the target attribute |
| 510 |
|
|
| 510 |
|
|
| 511 | 511 |
Operator. It must be one of the following: |
| 512 | 512 |
< Less Than |
| 513 | 513 |
<= Less Than Equals |
| ... | ... | |
| 515 | 515 |
!= Not Equal |
| 516 | 516 |
>= Greater Than Equals |
| 517 | 517 |
> Greater Than |
| 518 |
|
|
| 518 |
|
|
| 519 | 519 |
Right operand. The type of this operand depends on the keyword used |
| 520 | 520 |
for the left operand: |
| 521 |
class One of the "menu-*" class names as listed in the
|
|
| 521 |
class One of the "menu-*" class names as listed in the |
|
| 522 | 522 |
section "OUTPUT". |
| 523 | 523 |
level Test the page level against the following values: |
| 524 | 524 |
<number> absolute page level |
| ... | ... | |
| 535 | 535 |
the count of siblings in this menu. |
| 536 | 536 |
sibCount A positive integer. |
| 537 | 537 |
target A string, containing a possible target |
| 538 |
|
|
| 538 |
|
|
| 539 | 539 |
For example, valid tests are expression "exp" is emitted only when the menu item: |
| 540 |
|
|
| 540 |
|
|
| 541 | 541 |
[if(class==menu-expand){exp}] has a sub-menu
|
| 542 | 542 |
[if(class==menu-first){exp}] is first item in a menu
|
| 543 | 543 |
[if(class!=menu-first){exp}] is NOT first item in a menu
|
| ... | ... | |
| 551 | 551 |
[if(id==parent){exp}] is the parent of the current page
|
| 552 | 552 |
[if(target==_self){exp}] if value of target-attribute is '_self'
|
| 553 | 553 |
|
| 554 |
If an else-clause was added, then the expression for the else would be
|
|
| 554 |
If an else-clause was added, then the expression for the else would be |
|
| 555 | 555 |
emitted in all other cases. For example the expression "foo" is emitted |
| 556 | 556 |
whenever the if-test is false, so therefore: |
| 557 | 557 |
|
| ... | ... | |
| 560 | 560 |
|
| 561 | 561 |
For multiple tests, the expression "exp" is emitted only when the menu item: |
| 562 | 562 |
|
| 563 |
[if(sib == 1 || sib > 3){exp}]
|
|
| 563 |
[if(sib == 1 || sib > 3){exp}]
|
|
| 564 | 564 |
[is the first item] OR [is the 4th or larger item] in the menu |
| 565 |
|
|
| 565 |
|
|
| 566 | 566 |
[if(id == current && class == menu-expand){exp}
|
| 567 | 567 |
[is the current item] AND [it has children] |
| 568 | 568 |
|
| 569 | 569 |
Note that all tests are evaluated in the order listed because: |
| 570 | 570 |
* there is no short-circuit evaluation (all individual tests are always evaluated) |
| 571 | 571 |
* there is no grouping of tests (i.e. no support for parenthesis) |
| 572 |
* both || and && are considered the same level
|
|
| 572 |
* both || and && are considered the same level |
|
| 573 | 573 |
|
| 574 | 574 |
|
| 575 | 575 |
|
| ... | ... | |
| 577 | 577 |
========= |
| 578 | 578 |
Note: This is an advanced and rarely needed feature! |
| 579 | 579 |
|
| 580 |
If you are capable of extensive PHP programming, it is possible to replace the
|
|
| 580 |
If you are capable of extensive PHP programming, it is possible to replace the |
|
| 581 | 581 |
predefined menu formatter that show_menu2 is uses with a custom module. See the |
| 582 |
include.php file of show_menu2 for an example of how the menu formatter must be
|
|
| 582 |
include.php file of show_menu2 for an example of how the menu formatter must be |
|
| 583 | 583 |
written. The API it must use is: |
| 584 | 584 |
|
| 585 | 585 |
class SM2_Formatter |
| 586 | 586 |
{
|
| 587 | 587 |
// called once before any menu is processed to allow object initialization |
| 588 | 588 |
function initialize() { }
|
| 589 |
|
|
| 589 |
|
|
| 590 | 590 |
// called to open the menu list |
| 591 | 591 |
function startList($aPage, $aUrl) { }
|
| 592 |
|
|
| 592 |
|
|
| 593 | 593 |
// called to open the menu item |
| 594 | 594 |
function startItem($aPage, $aUrl, $aCurrSib, $aSibCount) { }
|
| 595 |
|
|
| 595 |
|
|
| 596 | 596 |
// called to close the menu item |
| 597 | 597 |
function finishItem() { }
|
| 598 |
|
|
| 598 |
|
|
| 599 | 599 |
// called to close the menu list |
| 600 | 600 |
function finishList() { }
|
| 601 |
|
|
| 601 |
|
|
| 602 | 602 |
// called once after all menu has been processed to allow object finalization |
| 603 | 603 |
function finalize() { }
|
| 604 |
|
|
| 604 |
|
|
| 605 | 605 |
// called once after finalize() if the SM2_NOOUTPUT flag is used |
| 606 | 606 |
function getOutput() { }
|
| 607 | 607 |
}; |
Also available in: Unified diff
! coreecting url to WB help in readme files module showmenu2