Project

General

Profile

Actions

Bug #28640

closed

TMENU_LAYERS does not always create unique IDs for the third level

Added by Kurt Gusbeth over 12 years ago. Updated about 11 years ago.

Status:
Rejected
Priority:
Could have
Assignee:
-
Category:
Content Rendering
Target version:
-
Start date:
2011-08-01
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

TMENU_LAYERS creates not unique IDs, if I use 2 TMENU_LAYERS menues.
Example:
temp.MENU_MAIN = HMENU
temp.MENU_MAIN {
entryLevel = 1
}
temp.MENU_MAIN.1 = TMENU_LAYERS
temp.MENU_MAIN.1 {
layerStyle = position:absolute;visibility:hidden;
lockPosition = x
...
}
temp.MENU_MAIN.2 = TMENU_LAYERS
temp.MENU_MAIN.2 {
layerStyle = position:absolute;visibility:hidden;
lockPosition = y
...
}
temp.MENU_MAIN.3 = TMENU
temp.MENU_MAIN.3 {
...
}
The IDs for the third level are not unique, if there are more entries/layers to display in the second and third level.
Example for the third level:

<div id="Menu1e532b0" style="z-index:9995; position:absolute;visibility:hidden;"><div class="menu1_main2"><a href="archiv.html" title="Archiv" onfocus="blurLink(this);">Archiv</a></div></div>
<div id="Menu1e532b0" style="z-index:9993; position:absolute;visibility:hidden;"><div class="menu1_main2"><a href="meldungen1.html" title="Meldungen" onfocus="blurLink(this);">Meldungen</a></div></div>
<div id="Menu1e532b1" style="z-index:9992; position:absolute;visibility:hidden;"><div class="menu1_main2"><a href="meldungen2.html" title="Meldungen" onfocus="blurLink(this);">Meldungen</a></div></div>

I have found a solution to fix this bug. The WMid makes the problems.
File: typo3/sysext/cms/tslib/media/scripts/tmenu_layers.php
The value for "$this->WMid" should contain more values.
I dont know which values so I have added a rand:

function extProc_init() {
$this->WMid = trim($this->mconf['layer_menu_id']) ? trim($this->mconf['layer_menu_id']).rand(0,99) . 'x' : substr(md5('gl' . serialize($this->mconf)), 0, 6).rand(0,99);

Note: the problem occurs not always. Some typo3 installations generate always a correct WMid.


Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #21388: typo3temp got filled with thousands of javascript_* filesRejected2009-10-28

Actions
Related to TYPO3 Core - Task #46358: Separate ext:statictemplates code from coreClosed2013-03-16

Actions
Is duplicate of TYPO3 Core - Bug #24367: changes in tmenu_layers.php broke TMENURejected2010-12-19

Actions
Is duplicate of TYPO3 Core - Bug #26739: TMENU_LAYERS produces identical layer IDsRejected2011-05-10

Actions
Actions #1

Updated by Björn Pedersen over 12 years ago

why don't you just use the "layer_menu_id" property of TMENU_LAYER to get unique names?

Otherwise it seems to be the same as http://forge.typo3.org/issues/24367.

Actions #2

Updated by Björn Pedersen over 12 years ago

Looking at the related bug reports, I think using rand is a bad idea ( the problem was introduced when removing the use of microtime that caused a flooding by temp-files).

Probably the menu items should get enumerated and the enumeration used as part of the id.

Actions #3

Updated by Kurt Gusbeth over 12 years ago

Björn Pedersen wrote:

why don't you just use the "layer_menu_id" property of TMENU_LAYER to get unique names?

I have tried "layer_menu_id" like described here:
http://www.typo3.net/tsref/menu_objects/gmenu_layers/
The "layer_menu_id" is valid for a whole level so the WMid is always the same.

Actions #4

Updated by Philipp Gampe over 12 years ago

IMHO TMENU_LAYERS should be deprecated instead of wasting time into it.
You can create much better menus with TMENU+CSS.

Actions #5

Updated by Thorsten Kahler over 12 years ago

  • Category set to Content Rendering
  • Status changed from New to Needs Feedback

Kurt, can you reproduce this on older TYPO3 versions too?

Actions #6

Updated by Kurt Gusbeth over 12 years ago

Thorsten Kahler wrote:

Kurt, can you reproduce this on older TYPO3 versions too?

Yes. I have this problem with Typo3 4.4.6 too.

Actions #7

Updated by Kurt Gusbeth over 12 years ago

If no layer_menu_id is given, the WMid will be generated like this:
substr(md5('gl' . serialize($this->mconf)), 0, 6);
It depends only on $this->mconf.
print_r($this->mconf) tells me this:

Array
(
    [layerStyle] => position:absolute;visibility:hidden;
    [lockPosition] => y
    [relativeToParentLayer] => 1
    [relativeToTriggerItem] => 1
    [topOffset] => 0
    [leftOffset] => 175
    [hideMenuWhenNotOver] => 100
    [hideMenuTimer] => 100
    [expAll] => 1
    [wrap] => <div class="menu1_main2_table">|</div> 
    [NO.] => Array
        (
            [allWrap] => <div class="menu1_main2"> | </div> 
            [ATagTitle.] => Array
                (
                    [field] => title
                )

        )

    [ACT] => 1
    [ACT.] => Array
        (
            [allWrap] => <div class="menu1_main2_act"> | </div> 
        )

    [IFSUB] => 1
    [IFSUB.] => Array
        (
            [allWrap] => <div class="menu1_main2_sub"> | </div> 
        )

)

$this->mconf is always the same for every menu of the third level.
Thats the reason why $this->WMid is always the same too => not unique IDs.

Actions #8

Updated by Kurt Gusbeth over 12 years ago

A better solution: replace rand(0,99) with this:

$GLOBALS['TSFE']->register['count_HMENU_MENUOBJ']

Actions #9

Updated by Chris topher over 12 years ago

  • Subject changed from TMENU_LAYERS creates not always unique IDs for the third level to TMENU_LAYERS does not always create unique IDs for the third level
Actions #10

Updated by Chris topher over 12 years ago

  • Target version changed from 4.6.0 to 4.6.1
Actions #11

Updated by Chris topher over 12 years ago

  • Target version changed from 4.6.1 to 4.6.2
Actions #12

Updated by Xavier Perseguers about 12 years ago

  • Target version deleted (4.6.2)
Actions #13

Updated by Christian Kuhn about 11 years ago

  • Status changed from Needs Feedback to Rejected

With 6.1 issue #46358, the _layers menus where moved to statictemplates, and statictemplates was removed from core afterwards. This issue won't be solved in the core anymore.

Actions

Also available in: Atom PDF