WebsiteBaker Support (2.12.x) > Modules

page_description in menu

<< < (2/2)

johnbroeckaert:
@CodeALot

thank you very much!

functions perfectly (Y)

Gast:

--- Quote from: johnbroeckaert on August 28, 2019, 08:50:35 PM ---Where is the readme you are talking about?

--- End quote ---

in modules/show_menu2/DOCS


--- Quote ---FORMAT STRINGS
==============
The following tags may be included in the format strings for $aItemOpen and
$aMenuOpen and will be replaced with the appropriate text.

[a]             <a> tag (no class):         '<a href="[url]" target="[target]">'
[ac]            <a> tag including class:    '<a href="[url]" target="[target]" class="[class]">'
[ li ]            <li> tag including class:   '<li class="[class]">'
[ul]            <ul> tag including class:   '<ul class="[class]">'
[class]         List of classes for that page
[menu_title]    Menu title text (HTML entity escaped unless SM2_NOESCAPE flag is used)
[menu_icon_0]   URL poining to an image for display normal - status (from WB2.8.4)
[menu_icon_1]   URL poining to an image for display active/hover - status (from WB2.8.4)
[page_title]    Page title text (HTML entity escaped unless SM2_NOESCAPE flag is used)
[page_icon]      URL poining to an image relating to the current page (from WB2.8.4)
[tooltip]       Tooltip caption, normaly shown in title-attribute of links (ab WB2.8.4)
[url]           Page URL for the <a> tag
[target]        Page target for the <a> tag
[page_id]       Page ID of the current menu item
[parent]        Page ID of the parent menu item
[level]         Page level, the same number as is used for the "menu-N" CSS tag.
[sib]           Current menu sibling number
[sibCount]      Total number of siblings in this menu
[if]            Conditional test (see section CONDITIONAL FORMATTING)

The following tags are only available when the SM2_ALLINFO flag is used.

[description]   Page description
[keywords]      Page keywords
--- End quote ---


--- Quote ---    SM2_ALLINFO     Load all fields from the page table of the database.
                                  This will result in quite a lot of memory being used
                                  and is not recommended, however it will make keywords,
                                  descriptions, and other fields available. This data
                                  is not loaded by default.
--- End quote ---

Only, to talk about.... it's, of course, also possible, to make a little change in show_menu2/include.php, if you dont want to load all datas for the whole menu tree, but with the risk, to lost this in the next upgrade. tell me, if you need more detailos about it

johnbroeckaert:
Hi Uwe,

The menu that i use to point out ONLY the external links is no bigger as 4 or 5 items. There is nothing else to do for this menu and it is only showing at the "home" page.


--- Quote ---Only, to talk about.... it's, of course, also possible, to make a little change in show_menu2/include.php, if you dont want to load all datas for the whole menu tree, but with the risk, to lost this in the next upgrade. tell me, if you need more detailos about it

--- End quote ---

Should I do something in the include.php file or just leave it this way.

John

Gast:

--- Quote from: johnbroeckaert on August 29, 2019, 04:03:47 PM ---Should I do something in the include.php file or just leave it this way.

--- End quote ---

hm.... not so easy to say  :wink:

without the flag "SM2_ALLINFO" the show_menu2-function load's the information from 15 data fields in table "pages" for every in this menu needed page or item, with "SM2_ALLINFO" 30 fields. at the end, we talk about some milliseconds and some bytes in the buffer for not needed informations like keywords, page_code etc.

if you forget to change it in the next upgrade, you lost the information about the page_description, if you dont use SM2_ALLINFO and i know, it's difficult to remember after two years or more, so maybe, SM2_ALLINFO is the best solution for you
i use some additional private fields in the pages table in my private projects, so i have not 30 fields to load, i've 40 or 45, for example: a subtitle für solutions like this here (screenshot from google)



it make's no sense for me, to load the whole pagetree with all the informations into the buffer to display only a couple of them in my menu. So i add the needed fields manually into the show_menu2/include.php and dont load everything from the database.

right place is here

the original code from WB 2.12.2 from modules/show_menu2/include.php Line 562 + 563

--- Code: ---        $fields  = '`parent`,`page_id`,`menu_title`,`page_title`,`link`,`target`,';
        $fields .= '`level`,`visibility`,`viewing_groups`, `page_trail`';
--- End code ---

for only one extra field, i add this at the end of line 562, if i have more fields, i add a new line behind 563 like



--- Code: ---        $fields  = '`parent`,`page_id`,`menu_title`,`page_title`,`link`,`target`,';
        $fields .= '`level`,`visibility`,`viewing_groups`, `page_trail`,';
        $fields .= '`subtitle`,`page_subdescription`,`shorturl`, `custom1`';
--- End code ---

in my special case, it's not possible to forget it in the upgrade, because, i work with a private solution and a free definable shorturl-keyword and the menu will not work without this keyword

my tip: if its not a private page, if its a customer project, take the secure solution with SM2_ALLINFO, that will work also in the future (i think)

johnbroeckaert:
thank you for your detailed explanation   (Y) (Y)

Navigation

[0] Message Index

[*] Previous page

Go to full version