1
|
show_menu2, version 4.7
|
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)
|
6
|
can be generated with extensive customisation of the resulting HTML.
|
7
|
|
8
|
|
9
|
|
10
|
INSTALLATION
|
11
|
============
|
12
|
1. Download the latest version from http://code.jellycan.com/show_menu2/
|
13
|
2. Log into your WebsiteBaker installation
|
14
|
3. Go to Addons -> Modules
|
15
|
4. If a previous version of show_menu2 is already installed, select it from
|
16
|
the "Uninstall Module" list and choose the "Uninstall" button.
|
17
|
5. In the "Install Module" section, enter the path to the show_menu2 zip file
|
18
|
that you downloaded in step 1, and choose the "Install" button.
|
19
|
|
20
|
|
21
|
|
22
|
USING SHOW_MENU2
|
23
|
================
|
24
|
You need to modify the PHP files of your template to call show_menu2 where you
|
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.
|
27
|
|
28
|
Often times the default menu generated by show_menu2 is all that you need.
|
29
|
This menu shows the current page and children of the current page. It is
|
30
|
generated by just calling show_menu2 with no parameters. For example:
|
31
|
|
32
|
show_menu2();
|
33
|
|
34
|
Note that the call to show_menu2 is PHP, so you usually need to wrap it in the
|
35
|
PHP code brackets so that it will execute. Like this:
|
36
|
|
37
|
<?php show_menu2(); ?>
|
38
|
|
39
|
This default menu generates a complete list based menu with many classes that
|
40
|
allow easy CSS styling. For example, the current menu item will have the
|
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
|
43
|
you to create CSS rules to style those menu items differently. For example:
|
44
|
|
45
|
li.menu-expand { font-weight: bold; }
|
46
|
li.menu-current { background: red; }
|
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,
|
51
|
to show only menu items from the top level of the menu you use:
|
52
|
|
53
|
show_menu2(0, SM2_ROOT, SM2_START);
|
54
|
|
55
|
Alternatively, to show up to two levels of the child menus of the current page:
|
56
|
|
57
|
show_menu2(0, SM2_CURR+1, SM2_CURR+2);
|
58
|
|
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.
|
61
|
|
62
|
|
63
|
|
64
|
COMMON QUESTIONS
|
65
|
================
|
66
|
|
67
|
Q: I'm not a programmer. Do you have simpler documentation?
|
68
|
A: Nup. This is it. Go hard. Gambarre.
|
69
|
|
70
|
|
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
|
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
|
75
|
|
76
|
|
77
|
Q: Why does the menu disappear after I do a search on my multilingual WB site?
|
78
|
A: You're missing some required lines in your template.
|
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:
|
83
|
|
84
|
<input type="hidden" name="referrer" value="[REFERRER_ID]" />
|
85
|
|
86
|
|
87
|
2. In the index.php of your template, add the following input field
|
88
|
immediately following the search <form> open tag.
|
89
|
|
90
|
<input type="hidden" name="referrer" value="<?php echo defined('REFERRER_ID')?REFERRER_ID:PAGE_ID;?>" />
|
91
|
|
92
|
|
93
|
Q: Multilingual? That sounds cool. How do I do that?
|
94
|
A: http://help.websitebaker.org/pages/en/advanced-docu.php
|
95
|
|
96
|
|
97
|
Q: SM2 is generating a warning every time the page is accessed:
|
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
|
101
|
correct flag values to pass for the $aOptions parameter.
|
102
|
|
103
|
|
104
|
|
105
|
FUNCTION
|
106
|
========
|
107
|
|
108
|
The complete call signature and default parameter value for show_menu2 is:
|
109
|
|
110
|
show_menu2(
|
111
|
$aMenu = 0,
|
112
|
$aStart = SM2_ROOT,
|
113
|
$aMaxLevel = SM2_CURR+1,
|
114
|
$aOptions = SM2_TRIM,
|
115
|
$aItemOpen = '[li][a][menu_title]</a>',
|
116
|
$aItemClose = '</li>',
|
117
|
$aMenuOpen = '[ul]',
|
118
|
$aMenuClose = '</ul>',
|
119
|
$aTopItemOpen = false,
|
120
|
$aTopMenuOpen = false
|
121
|
)
|
122
|
|
123
|
See the "Parameters" section for detailed descriptions of each parameter.
|
124
|
Ensure that you use each parameter correctly. Use the following rules:
|
125
|
|
126
|
$aMenu will be 0 for most people.
|
127
|
|
128
|
$aStart must be either a page ID or a value starting with "SM2_".
|
129
|
|
130
|
$aMaxLevel must be only values that start with "SM2_".
|
131
|
|
132
|
$aOptions must be only values that start with "SM2_" (unless you are
|
133
|
in a very small minority of users).
|
134
|
|
135
|
All other parameters are the HTML tag templates that will be
|
136
|
output for menus and menu items.
|
137
|
|
138
|
Note that every parameter from $aItemOpen can be supplied as false to get
|
139
|
the default value.
|
140
|
|
141
|
|
142
|
|
143
|
OUTPUT
|
144
|
======
|
145
|
The menu is output differently depending on what parameters have been
|
146
|
supplied to the function, however in general the following classes are used
|
147
|
for each menu. Note that items will have multiple classes when relevant.
|
148
|
|
149
|
CLASS ATTACHED TO
|
150
|
------------ -------------------------------------------------------
|
151
|
menu-top First menu tag only
|
152
|
menu-parent Every parent menu item of the current page.
|
153
|
menu-current Only the menu item for the current page.
|
154
|
menu-sibling Every sibling of the current page.
|
155
|
menu-child Every sub-menu of the current page.
|
156
|
menu-expand Every menu item with children.
|
157
|
menu-first First item in any menu or sub-menu.
|
158
|
menu-last Last item in any menu or sub-menu.
|
159
|
|
160
|
The following classes are added only if SM2_NUMCLASS flag has been used.
|
161
|
|
162
|
menu-N Every menu item. The N is replaced with the ABSOLUTE
|
163
|
menu depth of the item starting with 0. The root level
|
164
|
menu is always menu-0, the next level is menu-1, etc.
|
165
|
menu-child-N Every sub-menu of the current page, the N is replaced
|
166
|
with the relative depth of the submenu starting at 0.
|
167
|
|
168
|
|
169
|
<ul class="menu-top menu-0">
|
170
|
<li class="menu-0 menu-first"> ... </li>
|
171
|
<li class="menu-0 menu-expand menu-parent"> ...
|
172
|
<ul class="menu-1">
|
173
|
<li class="menu-1 menu-expand menu-first"> ...
|
174
|
<ul class="menu-2">
|
175
|
<li class="menu-2 menu-first"> ...
|
176
|
<li class="menu-2 menu-last"> ...
|
177
|
</ul>
|
178
|
</li>
|
179
|
<li class="menu-1 menu-expand menu-parent"> ...
|
180
|
<ul class="menu-2">
|
181
|
<li class="menu-2 menu-expand menu-current menu-first"> ... ** CURRENT PAGE **
|
182
|
<ul class="menu-3">
|
183
|
<li class="menu-3 menu-child menu-child-0 menu-first"> ...
|
184
|
<ul class="menu-4">
|
185
|
<li class="menu-4 menu-child menu-child-1 menu-first"> ... </li>
|
186
|
<li class="menu-4 menu-child menu-child-1 menu-last"> ... </li>
|
187
|
</ul>
|
188
|
</li>
|
189
|
<li class="menu-3 menu-child menu-child-0 menu-last"> ... </li>
|
190
|
</ul>
|
191
|
</li>
|
192
|
<li class="menu-2 menu-sibling menu-last"> ... </li>
|
193
|
</ul>
|
194
|
</li>
|
195
|
<li class="menu-1"> ... </li>
|
196
|
<li class="menu-1 menu-expand menu-last"> ...
|
197
|
<ul class="menu-2">
|
198
|
<li class="menu-2 menu-first menu-last"> ... </li>
|
199
|
</ul>
|
200
|
</li>
|
201
|
</ul>
|
202
|
</li>
|
203
|
<li class="menu-0 menu-last"> ... </li>
|
204
|
</ul>
|
205
|
|
206
|
|
207
|
|
208
|
PARAMETERS
|
209
|
==========
|
210
|
$aMenu
|
211
|
Menu number to use. This is useful when you are using multiple menus.
|
212
|
Supplying a menu number of 0 will use the default menu for the current
|
213
|
page. Supplying SM2_ALLMENU will return all menus in the system.
|
214
|
|
215
|
$aStart
|
216
|
Specify where the menu generation should start from. This is most
|
217
|
times the parent item of the menu to display. It must be one of the
|
218
|
following values:
|
219
|
SM2_ROOT+N Start N levels down from the root. e.g.
|
220
|
SM2_ROOT Starting at the root menu
|
221
|
SM2_ROOT+1 Start 1 level below the root
|
222
|
SM2_ROOT+2 Start 2 levels below the root
|
223
|
SM2_CURR+N Start N levels down from the current page level. e.g.
|
224
|
SM2_CURR Starts at the current page level. All
|
225
|
sibling menus to the current page.
|
226
|
SM2_CURR+1 Starts 1 level down from the current
|
227
|
page with the children menus.
|
228
|
page_id Display using the specific page as the parent. All
|
229
|
child menus of that page will be displayed. The
|
230
|
page_id can be found by editing the page in WB admin
|
231
|
interface. The page_id is included in the URL like:
|
232
|
http://SITE/admin/pages/modify.php?page_id=35
|
233
|
|
234
|
$aMaxLevel
|
235
|
Maximum menu level to display. Menus are displayed from the start
|
236
|
level down to this level.
|
237
|
SM2_ALL No limit, all levels are displayed
|
238
|
SM2_CURR+N Always show to the current page + N levels.
|
239
|
SM2_CURR Current (no children)
|
240
|
SM2_CURR+3 All parents + current + 3 children
|
241
|
SM2_START+N Always show from the starting level + N levels. The
|
242
|
levels of menu will always be displayed regardless of
|
243
|
what level the current page is.
|
244
|
SM2_START Single level of menus from starting level
|
245
|
SM2_START+1 Starting level and 1 level down
|
246
|
SM2_MAX+N Show at most N levels from the starting level. Levels
|
247
|
won't be shown if they are below the current level.
|
248
|
SM2_MAX Starting level only (same as SM2_START)
|
249
|
SM2_MAX+1 Maximum of starting level and 1 level.
|
250
|
|
251
|
$aOptions
|
252
|
Specify flags for different generation options for the menu. The flags
|
253
|
may be combined together using bitwise OR (|). For example, to specify
|
254
|
both TRIM and PRETTY you should use, (SM2_TRIM | SM2_PRETTY).
|
255
|
|
256
|
GROUP 1
|
257
|
-------
|
258
|
Exactly one flag from this group must always be supplied. These flags
|
259
|
affect how the siblings in the tree are removed from the output.
|
260
|
|
261
|
SM2_ALL Show all branches of the menu tree
|
262
|
A-1 -> B-1
|
263
|
-> B-2 -> C-1
|
264
|
-> C-2 (CURRENT)
|
265
|
-> D-1
|
266
|
-> D-2
|
267
|
-> C-3
|
268
|
A-2 -> B-3
|
269
|
-> B-4
|
270
|
SM2_TRIM Show all sibling menus of pages on the current path.
|
271
|
All sub-menus of elements that are not on the path
|
272
|
are removed.
|
273
|
A-1 -> B-1
|
274
|
-> B-2 -> C-1
|
275
|
-> C-2 (CURRENT)
|
276
|
-> D-1
|
277
|
-> D-2
|
278
|
-> C-3
|
279
|
A-2
|
280
|
SM2_CRUMB Show only the breadcrumb trail, i.e. the current
|
281
|
menu and all of it's ancestor menus.
|
282
|
A-1 -> B-2 -> C-2 (CURRENT)
|
283
|
SM2_SIBLING The same as SM2_TRIM however only sibling menus of
|
284
|
the current page are displayed. All other menus are
|
285
|
trimmed to show only the path.
|
286
|
A-1 -> B-2 -> C-1
|
287
|
-> C-2 (CURRENT)
|
288
|
-> D-1
|
289
|
-> D-2
|
290
|
-> C-3
|
291
|
|
292
|
GROUP 2
|
293
|
-------
|
294
|
All of these flags are optional. Any number of them may be combined.
|
295
|
|
296
|
SM2_NUMCLASS Add the numbered menu classes to the menu. If this
|
297
|
flag is supplied, the "menu-N" and "menu-child-N"
|
298
|
classes will be added.
|
299
|
SM2_ALLINFO Load all fields from the page table of the database.
|
300
|
This will result in quite a lot of memory being used
|
301
|
and is not recommended, however it will make keywords,
|
302
|
descriptions, and other fields available. This data
|
303
|
is not loaded by default.
|
304
|
NOTE: This flag must be used on the *FIRST* call to
|
305
|
show_menu2 *for this menu ID*, or in combination with
|
306
|
SM2_NOCACHE otherwise it will have no effect.
|
307
|
SM2_NOCACHE Do not reuse or store the data read from the database
|
308
|
between calls to show_menu2.
|
309
|
SM2_PRETTY Pretty print the menu HTML with spacing and newlines
|
310
|
for debugging purposes.
|
311
|
SM2_BUFFER Do not output the menu HTML but instead buffer it
|
312
|
internally and return it as a string from show_menu2.
|
313
|
SM2_CURRTREE Exclude all other top level menus from being considered.
|
314
|
Only items in the current menu tree will be output.
|
315
|
This can be combined with any of the Group 1 flags as
|
316
|
necessary.
|
317
|
SM2_ESCAPE Call htmlspecialchars on the menu strings. This may be
|
318
|
required with older installations of WB. By escaping the
|
319
|
raw database strings, it permits menus to have HTML
|
320
|
formatting in them that would cause otherwise cause
|
321
|
pages to fail validation.
|
322
|
SM2_NOESCAPE Default behaviour. Exists only for backwards compatibility.
|
323
|
|
324
|
This parameter also has an extended mode where an associative array of
|
325
|
options is supplied. See the EXTENDED OPTIONS section for details.
|
326
|
Most users will NOT need to use this.
|
327
|
|
328
|
$aItemOpen
|
329
|
Format string to use for creating each individual menu item entry.
|
330
|
A different format string may be used for the very first entry by
|
331
|
supplying a different format string for $aTopItemOpen. When set to
|
332
|
false, it uses the default of '[li][a][menu_title]</a>' to maintain
|
333
|
compatibility with show_menu(). Note however that CSS formatting is
|
334
|
often easier if the classes are added to the <a> tag. Use the format
|
335
|
string of '<li>[ac][menu_title]</a>' for this style of tag.
|
336
|
|
337
|
This parameter may also be specified as an instance of a formatting
|
338
|
class for the menu. See the section "Formatter" below for details of
|
339
|
the API this class must expose. When a formatter is supplied, all
|
340
|
arguments after $aItemOpen are ignored.
|
341
|
|
342
|
$aItemClose
|
343
|
String used to close each item. Note that this is not a format
|
344
|
string and no keywords will be replaced. When set to false, it uses
|
345
|
the default of '</li>'.
|
346
|
|
347
|
$aMenuOpen
|
348
|
Format string to use for opening a list of menu item entries. A
|
349
|
different format string may be used for the very first menu by
|
350
|
supplying a different format string for $aTopMenuOpen. When set to
|
351
|
false, it uses the default of '[ul]'.
|
352
|
|
353
|
$aMenuClose
|
354
|
String used to close each menu. Note that this is not a format
|
355
|
string and no keywords will be replaced. When set to false, it uses
|
356
|
the default of '</ul>'.
|
357
|
|
358
|
$aTopItemOpen
|
359
|
Format string for the first item. When set to false, it uses the same
|
360
|
format as $aItemOpen.
|
361
|
|
362
|
$aTopMenuOpen
|
363
|
Format string for the first menu. When set to false, it uses the same
|
364
|
format as $aMenuOpen.
|
365
|
|
366
|
|
367
|
|
368
|
EXTENDED OPTIONS
|
369
|
================
|
370
|
The $aOptions parameter is a dual mode parameter. For most users, only the
|
371
|
SM2_* flags will be sufficient. However, to access the extra options, it
|
372
|
must be supplied as an associative array. Note that the SM2_* flags are
|
373
|
still required and must be supplied as 'flags'.
|
374
|
|
375
|
'flags' **REQUIRED** These are the flags described in PARAMETERS
|
376
|
above for the $aOptions parameter.
|
377
|
|
378
|
'notrim' Specify a number of levels relative to the menu level of
|
379
|
$aStart that will always be displayed. This will cause the
|
380
|
SM2_TRIM flag to be ignored for these levels.
|
381
|
|
382
|
To supply one of these options in addition to the flags, the option array
|
383
|
should be created and passed as the $aOptions parameter:
|
384
|
|
385
|
$options = array('flags' => (SM2_TRIM|...), 'notrim' => 1);
|
386
|
show_menu2(0, SM2_ROOT, SM2_CURR+1, $options);
|
387
|
|
388
|
|
389
|
|
390
|
FORMAT STRINGS
|
391
|
==============
|
392
|
The following tags may be included in the format strings for $aItemOpen and
|
393
|
$aMenuOpen and will be replaced with the appropriate text.
|
394
|
|
395
|
[a] <a> tag (no class): '<a href="[url]" target="[target]">'
|
396
|
[ac] <a> tag including class: '<a href="[url]" target="[target]" class="[class]">'
|
397
|
[li] <li> tag including class: '<li class="[class]">'
|
398
|
[ul] <ul> tag including class: '<ul class="[class]">'
|
399
|
[class] List of classes for that page
|
400
|
[menu_title] Menu title text (HTML entity escaped unless SM2_NOESCAPE flag is used)
|
401
|
[page_title] Page title text (HTML entity escaped unless SM2_NOESCAPE flag is used)
|
402
|
[url] Page URL for the <a> tag
|
403
|
[target] Page target for the <a> tag
|
404
|
[page_id] Page ID of the current menu item
|
405
|
[parent] Page ID of the parent menu item
|
406
|
[level] Page level, the same number as is used for the "menu-N" CSS tag.
|
407
|
[sib] Current menu sibling number
|
408
|
[sibCount] Total number of siblings in this menu
|
409
|
[if] Conditional test (see section CONDITIONAL FORMATTING)
|
410
|
|
411
|
The following tags are only available when the SM2_ALLINFO flag is used.
|
412
|
|
413
|
[description] Page description
|
414
|
[keywords] Page keywords
|
415
|
|
416
|
|
417
|
|
418
|
CONDITIONAL FORMATTING
|
419
|
======================
|
420
|
The conditional formatting directive takes one of the following forms:
|
421
|
|
422
|
[if(A){B}]
|
423
|
[if(A){B}else{C}]
|
424
|
|
425
|
A Conditional test. See below for more details.
|
426
|
|
427
|
B Expression emitted when the if-test is true. This may be any string
|
428
|
that does NOT include the '}' character. It may include any of the
|
429
|
format strings described in the section FORMAT STRINGS with the
|
430
|
exception of the conditional test (because '}' is not permitted).
|
431
|
|
432
|
C Expression emitted when the if-test is false. This may be any string
|
433
|
that does NOT include the '}' character. It may include any of the
|
434
|
format strings described in the section FORMAT STRINGS with the
|
435
|
exception of the conditional test (because '}' is not permitted).
|
436
|
|
437
|
The conditional test is a combination of one or more boolean tests.
|
438
|
If more than one test is supplied, it must be combined with other tests
|
439
|
using either || (boolean OR) or && (boolean AND).
|
440
|
|
441
|
A single test is made up of the left operand, operator and right operand.
|
442
|
e.g. X == Y where X is the left operand, == is the operator and Y is the
|
443
|
right operand.
|
444
|
|
445
|
Left operand. It must be one of the following keywords:
|
446
|
class Test for existence of one of the classes. Only the
|
447
|
"==" and "!=" operators are permitted. In this case
|
448
|
these operators have the meaning of "includes"
|
449
|
instead of "equals".
|
450
|
level Test against the page level.
|
451
|
sib Test against the current page sibling number.
|
452
|
sibCount Test against the number of siblings in the menu.
|
453
|
id Test against the page id.
|
454
|
|
455
|
Operator. It must be one of the following:
|
456
|
< Less Than
|
457
|
<= Less Than Equals
|
458
|
== Equals
|
459
|
!= Not Equal
|
460
|
>= Greater Than Equals
|
461
|
> Greater Than
|
462
|
|
463
|
Right operand. The type of this operand depends on the keyword used
|
464
|
for the left operand:
|
465
|
class One of the "menu-*" class names as listed in the
|
466
|
section "OUTPUT".
|
467
|
level Test the page level against the following values:
|
468
|
<number> absolute page level
|
469
|
root the root page level
|
470
|
granny the grand-parent page level
|
471
|
parent the parent page level
|
472
|
current the current page level
|
473
|
child the child page level
|
474
|
id Test the page id against the following values:
|
475
|
<number> absolute page id
|
476
|
parent the parent page id
|
477
|
current the current page id
|
478
|
sib A positive integer, or "sibCount" to test against
|
479
|
the count of siblings in this menu.
|
480
|
sibCount A positive integer.
|
481
|
|
482
|
For example, valid tests are expression "exp" is emitted only when the menu item:
|
483
|
|
484
|
[if(class==menu-expand){exp}] has a sub-menu
|
485
|
[if(class==menu-first){exp}] is first item in a menu
|
486
|
[if(class!=menu-first){exp}] is NOT first item in a menu
|
487
|
[if(class==menu-last){exp}] is last item in a menu
|
488
|
[if(level==0){exp}] is at the root
|
489
|
[if(level>0){exp}] is not at the root
|
490
|
[if(sib==2){exp}] is the second item in a menu
|
491
|
[if(sibCount>1){exp}] is in a menu with more than 1 entry
|
492
|
[if(sibCount!=2){exp}] is in a menu which doesn't have exactly
|
493
|
[if(level>parent){exp}] is in a sibling menu or child of a sibling
|
494
|
[if(id==parent){exp}] is the parent of the current page
|
495
|
|
496
|
If an else-clause was added, then the expression for the else would be
|
497
|
emitted in all other cases. For example the expression "foo" is emitted
|
498
|
whenever the if-test is false, so therefore:
|
499
|
|
500
|
[if(sib==2){exp}else{foo}] is NOT the second item in a menu
|
501
|
[if(sibCount>2){exp}else{foo}] is NOT in a menu with more than 2 entries
|
502
|
|
503
|
For multiple tests, the expression "exp" is emitted only when the menu item:
|
504
|
|
505
|
[if(sib == 1 || sib > 3){exp}]
|
506
|
[is the first item] OR [is the 4th or larger item] in the menu
|
507
|
|
508
|
[if(id == current && class == menu-expand){exp}
|
509
|
[is the current item] AND [it has children]
|
510
|
|
511
|
Note that all tests are evaluated in the order listed because:
|
512
|
* there is no short-circuit evaluation (all individual tests are always evaluated)
|
513
|
* there is no grouping of tests (i.e. no support for parenthesis)
|
514
|
* both || and && are considered the same level
|
515
|
|
516
|
|
517
|
|
518
|
FORMATTER
|
519
|
=========
|
520
|
Note: This is an advanced and rarely needed feature!
|
521
|
|
522
|
If you are capable of extensive PHP programming, it is possible to replace the
|
523
|
predefined menu formatter that show_menu2 is uses with a custom module. See the
|
524
|
include.php file of show_menu2 for an example of how the menu formatter must be
|
525
|
written. The API it must use is:
|
526
|
|
527
|
class SM2_Formatter
|
528
|
{
|
529
|
// called once before any menu is processed to allow object initialization
|
530
|
function initialize() { }
|
531
|
|
532
|
// called to open the menu list
|
533
|
function startList($aPage, $aUrl) { }
|
534
|
|
535
|
// called to open the menu item
|
536
|
function startItem($aPage, $aUrl, $aCurrSib, $aSibCount) { }
|
537
|
|
538
|
// called to close the menu item
|
539
|
function finishItem() { }
|
540
|
|
541
|
// called to close the menu list
|
542
|
function finishList() { }
|
543
|
|
544
|
// called once after all menu has been processed to allow object finalization
|
545
|
function finalize() { }
|
546
|
|
547
|
// called once after finalize() if the SM2_NOOUTPUT flag is used
|
548
|
function getOutput() { }
|
549
|
};
|