Revision 971
Added by Matthias over 16 years ago
| trunk/CHANGELOG | ||
|---|---|---|
| 12 | 12 |
|
| 13 | 13 |
------------------------------------- 2.8.0 ------------------------------------- |
| 14 | 14 |
20-Apr-2009 Matthias Gallas |
| 15 |
! Update show_menu2 to version 4.8 (ticket #712) |
|
| 15 | 16 |
# Fixed small error in Spain language file (ticket #711) |
| 16 | 17 |
18-Apr-2009 Matthias Gallas |
| 17 | 18 |
! Updated Dutch language file (Thanks to Luckyluke) |
| trunk/wb/modules/show_menu2/info.php | ||
|---|---|---|
| 39 | 39 |
$module_directory = 'show_menu2'; |
| 40 | 40 |
$module_name = 'show_menu2'; |
| 41 | 41 |
$module_function = 'snippet'; |
| 42 |
$module_version = '4.7';
|
|
| 42 |
$module_version = '4.8';
|
|
| 43 | 43 |
$module_platform = '2.6.x | 2.7.x'; |
| 44 | 44 |
$module_author = 'Brodie Thiesfield'; |
| 45 | 45 |
$module_license = 'GNU General Public License'; |
| trunk/wb/modules/show_menu2/README.de.txt | ||
|---|---|---|
| 1 |
show_menu2, version 4.7
|
|
| 1 |
show_menu2, version 4.8
|
|
| 2 | 2 |
======================= |
| 3 | 3 |
Ist ein Code-Snippet für das CMS Website Baker. Es stellt einen kompletten |
| 4 | 4 |
Ersatz für die eingebaute Menüfuntionalität zur Verfügung. Alle, für die |
| ... | ... | |
| 118 | 118 |
$aOptions Parameter zu übergeben sind. |
| 119 | 119 |
|
| 120 | 120 |
|
| 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 |
|
| 123 |
class or id for each menu item, then reference that item in your CSS or Javascript |
|
| 124 |
to do whatever you want. |
|
| 121 | 125 |
|
| 126 |
To add a unique class for each menu item (or similar): |
|
| 127 |
|
|
| 128 |
"<li><a href="[url]" target="[target]" class="[class] p[page_id]">[menu_title]</a>" |
|
| 129 |
|
|
| 130 |
... creating menu items like ... |
|
| 131 |
|
|
| 132 |
<li><a href="/pages/foo/bar.php" target="_top" class="menu-top p45">Top Menu</a> |
|
| 133 |
|
|
| 134 |
Reference this in your CSS like: |
|
| 135 |
|
|
| 136 |
a.p45 { color: red; }
|
|
| 137 |
|
|
| 138 |
To add a unique ID for each menu item (or similar): |
|
| 139 |
|
|
| 140 |
"<li><a id="p[page_id]" href="[url]" target="[target]" class="[class]">[menu_title]</a>" |
|
| 141 |
|
|
| 142 |
... creating menu items like ... |
|
| 143 |
|
|
| 144 |
<li><a id="p45" href="/pages/foo/bar.php" target="_top" class="menu-top">Top Menu</a> |
|
| 145 |
|
|
| 146 |
Reference this in your CSS like: |
|
| 147 |
|
|
| 148 |
a#p45 { color: red; }
|
|
| 149 |
|
|
| 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 |
|
|
| 122 | 154 |
FUNKTION |
| 123 | 155 |
======== |
| 124 | 156 |
|
| trunk/wb/modules/show_menu2/include.php | ||
|---|---|---|
| 22 | 22 |
02110-1301, USA. |
| 23 | 23 |
|
| 24 | 24 |
*********************************************** |
| 25 |
** Version 4.7: see README for documentation **
|
|
| 25 |
** Version 4.8: see README for documentation **
|
|
| 26 | 26 |
*********************************************** |
| 27 | 27 |
*/ |
| 28 | 28 |
|
| ... | ... | |
| 529 | 529 |
$sql = "SELECT $fields FROM ".TABLE_PREFIX. |
| 530 | 530 |
"pages WHERE $wb->extra_where_sql $menuLimitSql ". |
| 531 | 531 |
'ORDER BY level ASC, position ASC'; |
| 532 |
$sql = str_replace('hidden', 'IGNOREME', $sql); // we want the hidden pages
|
|
| 532 | 533 |
$oRowset = $database->query($sql); |
| 533 | 534 |
if (is_object($oRowset) && $oRowset->numRows() > 0) {
|
| 534 | 535 |
// create an in memory array of the database data based on the item's parent. |
| ... | ... | |
| 536 | 537 |
while ($page = $oRowset->fetchRow()) {
|
| 537 | 538 |
// ignore all pages that the current user is not permitted to view |
| 538 | 539 |
if(version_compare(WB_VERSION, '2.7', '>=')) { // WB >= 2.7
|
| 539 |
// 1. all pages with no active sections (unless it is the top page) are ignored
|
|
| 540 |
if (!$wb->page_is_active($page) && $page['link'] != $wb->default_link && !INTRO_PAGE) {
|
|
| 541 |
continue;
|
|
| 540 |
// 1. hidden pages aren't shown unless they are on the current page
|
|
| 541 |
if ($page['visibility'] == 'hidden') {
|
|
| 542 |
$page['sm2_hide'] = true;
|
|
| 542 | 543 |
} |
| 543 |
// 2. all pages not visible to this user (unless always visible to registered users) are ignored |
|
| 544 |
if (!$wb->page_is_visible($page) && $page['visibility'] != 'registered') {
|
|
| 544 |
|
|
| 545 |
// 2. all pages with no active sections (unless it is the top page) are ignored |
|
| 546 |
else if (!$wb->page_is_active($page) && $page['link'] != $wb->default_link && !INTRO_PAGE) {
|
|
| 545 | 547 |
continue; |
| 546 | 548 |
} |
| 549 |
|
|
| 550 |
// 3. all pages not visible to this user (unless always visible to registered users) are ignored |
|
| 551 |
else if (!$wb->page_is_visible($page) && $page['visibility'] != 'registered') {
|
|
| 552 |
continue; |
|
| 553 |
} |
|
| 547 | 554 |
} |
| 548 | 555 |
else { // WB < 2.7
|
| 549 | 556 |
// We can't do this in SQL as the viewing_groups column contains multiple |
| ... | ... | |
| 567 | 574 |
if ($page['page_id'] == $CURR_PAGE_ID) {
|
| 568 | 575 |
$page['sm2_is_curr'] = true; |
| 569 | 576 |
$page['sm2_on_curr_path'] = true; |
| 577 |
unset($page['sm2_hide']); // don't hide the current page |
|
| 570 | 578 |
} |
| 571 | 579 |
|
| 572 | 580 |
// mark parents of the current page as such |
| 573 | 581 |
if (in_array($page['page_id'], $rgCurrParents)) {
|
| 574 | 582 |
$page['sm2_is_parent'] = true; |
| 575 | 583 |
$page['sm2_on_curr_path'] = true; |
| 584 |
unset($page['sm2_hide']); // don't hide a parent page |
|
| 576 | 585 |
} |
| 577 | 586 |
|
| 578 | 587 |
// add the entry to the array |
| trunk/wb/modules/show_menu2/README.en.txt | ||
|---|---|---|
| 1 |
show_menu2, version 4.7
|
|
| 1 |
show_menu2, version 4.8
|
|
| 2 | 2 |
======================= |
| 3 | 3 |
A code snippet for the Website Baker CMS software. It provides a complete |
| 4 | 4 |
replacement for the builtin menu functions. All menu data is retrieved using |
| ... | ... | |
| 101 | 101 |
correct flag values to pass for the $aOptions parameter. |
| 102 | 102 |
|
| 103 | 103 |
|
| 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 |
|
| 106 |
class or id for each menu item, then reference that item in your CSS or Javascript |
|
| 107 |
to do whatever you want. |
|
| 108 |
|
|
| 109 |
To add a unique class for each menu item (or similar): |
|
| 110 |
|
|
| 111 |
"<li><a href="[url]" target="[target]" class="[class] p[page_id]">[menu_title]</a>" |
|
| 104 | 112 |
|
| 113 |
... creating menu items like ... |
|
| 114 |
|
|
| 115 |
<li><a href="/pages/foo/bar.php" target="_top" class="menu-top p45">Top Menu</a> |
|
| 116 |
|
|
| 117 |
Reference this in your CSS like: |
|
| 118 |
|
|
| 119 |
a.p45 { color: red; }
|
|
| 120 |
|
|
| 121 |
To add a unique ID for each menu item (or similar): |
|
| 122 |
|
|
| 123 |
"<li><a id="p[page_id]" href="[url]" target="[target]" class="[class]">[menu_title]</a>" |
|
| 124 |
|
|
| 125 |
... creating menu items like ... |
|
| 126 |
|
|
| 127 |
<li><a id="p45" href="/pages/foo/bar.php" target="_top" class="menu-top">Top Menu</a> |
|
| 128 |
|
|
| 129 |
Reference this in your CSS like: |
|
| 130 |
|
|
| 131 |
a#p45 { color: red; }
|
|
| 132 |
|
|
| 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 |
|
|
| 136 |
|
|
| 137 |
|
|
| 105 | 138 |
FUNCTION |
| 106 | 139 |
======== |
| 107 | 140 |
|
| ... | ... | |
| 140 | 173 |
|
| 141 | 174 |
|
| 142 | 175 |
|
| 143 |
OUTPUT |
|
| 144 |
====== |
|
| 176 |
HTML OUTPUT
|
|
| 177 |
===========
|
|
| 145 | 178 |
The menu is output differently depending on what parameters have been |
| 146 | 179 |
supplied to the function, however in general the following classes are used |
| 147 | 180 |
for each menu. Note that items will have multiple classes when relevant. |
Also available in: Unified diff
Update show_menu2 to version 4.8 (ticket #712)