[TYPO3] Unable to get the correct register: value! [SOLVED!]

Surer Dink surerlistmail at gmail.com
Mon Feb 27 17:49:50 CET 2006


Peter,
  We are finally on common ground.  Thank you!

  The "correct" solution is to wrap the menu in a COA, including not just
the TMENU but also the LOAD_REGISTER to save the value of count_menuItems.
The final (working) code of two menus (horizontal and vertical) with the
header/css affected based on the menu count is tacked on the bottom of this
email.  There are two ugly points - the use of .headerData is ugly to add
css, it would be much more appropriate to use CSS_inlineStyle however for
some reason this property of PAGE does _NOT_ use stdWrap and is just a plain
string (perhaps this warrants a feature request to the developers?).  The
second ugly point is in the use of cObject.dataWrap , I do not understand
why this is necessary to use "cObject" there get priocalc=1 to work, this
too is minor/has been alluded to in previous posts/may be a bug.

  Again, thank you for all your help!

(the code below expects for a TemplaVoila template to exist, with two UL
elements mapped to TypoScript: lib.nav and lib.menu; the same holds true for
a template without TemplaVoila, e.g.
page = PAGE
page.10 < lib.nav
page.20 < lib.tree
page.headData.10 = TEXT ...)

temp {
  amenu = TMENU
  amenu {
     noBlur = 1
     ACT=1
     NO {
       allWrap = <li>|</li>
       stdWrap.htmlSpecialChars = 1
     }
     ACT {
       wrapItemAndSub = <li>|</li>
       stdWrap.htmlSpecialChars = 1
     }
  }
}

lib {
  nav = COA
  nav {
    10 = HMENU
    10 {
      entryLevel = 1
      1 < temp.amenu
      1.wrap = <ul id="nav">|</ul>
    }
    20 = LOAD_REGISTER
    20.myCounter.data = register:count_menuItems
  }
  tree = HMENU
  tree {
    entryLevel = 2
    1 < temp.amenu
    1.wrap = <ul id="tree">|</ul>
    2 < temp.amenu
    2.wrap = <ul>|</ul>
  }
}

page = PAGE
page.config.index_enable = 1
page.10 = USER
page.10.userFunc = tx_templavoila_pi1->main_page
page.headerData.10 = TEXT
page.headerData.10 {
  cObject = TEXT
  cObject.dataWrap = 100/{register:myCounter}
  prioriCalc = 1
  wrap = <style type="text/css">/*<![CDATA[*/ ul#nav li { width: | %;
}/*]]>*/</style>
}



On 2/27/06, Peter Klein <peter at umloud.dk> wrote:
> Hi Surer. That explains why it doesn't work, as you do this:
>
> page.10 < lib.menus.10
> page.30 < lib.menus.30
>
> Which results in the 20 part of the libs.menus, never gets executed!
> Instead try:
>
> page.10 < lib.menus
>
> And remove the "page.30" part.



More information about the TYPO3-english mailing list