[TYPO3] Unable to get the correct register: value!
Surer Dink
surerlistmail at gmail.com
Sat Feb 25 20:03:47 CET 2006
Peter,
Per your recommendation, I have made the following changes (please
confirm this is all I should have done):
1) made an extra object under lib = COA
2) changed string names of nav, tree, and friends to integers
3) added LOAD_REGISTER intermediate
My code now looks like this:
lib.menus = COA
lib.menus {
10 = HMENU
10 {
entryLevel = 1
1 < temp.amenu
1.wrap = <ul id="nav">|</ul>
}
20 = LOAD_REGISTER
20.myCounter.data = register:count_menuItems
35 = TEXT
35 {
cObject = TEXT
cObject.dataWrap = 100/{register:myCounter}
prioriCalc = 1
wrap = <style type="text/css">/*<![CDATA[*/ ul#nav li { width: |
%; }/*]]>*/</style>
}
30 = HMENU
30 {
entryLevel = 2
1 < temp.amenu
1.wrap = <ul id="tree">|</ul>
2 < temp.amenu
2.wrap = <ul>|</ul>
}
}
...
page.headerData.1 < lib.menus.35
As a result, the page header now contains:
<style type="text/css">/*<![CDATA[*/ ul#nav li { width:ERROR: dividing
by zero%; }/*]]>*/</style>
Please advise.
On 2/25/06, Peter Klein <peter at umloud.dk> wrote:
> Hi Surer. To save the count_menuItems register value, you can do something
> like this:
>
> -- cut --
> lib.blabla = COA
> lib.blabla {
> 10 = HMENU
> 10 {
> # Rest of menusetup here
> }
> # This part saves the temp "count_menuItems" register value in a
> userdefined register value named "myCounter"
> 20 = LOAD_REGISTER
> 20.myCounter.data = register:count_menuItems
> }
> -- cut --
>
> Then instead of using "cObject.dataWrap = 100/{register:count_menuItems}"
> you then use "cObject.dataWrap = 100/{register:myCounter}"
>
> ---
> Peter Klein / Umloud Untd.
>
>
> "Surer Dink" <surerlistmail at gmail.com> wrote in message
> news:mailman.4353.1140888106.3122.typo3-english at lists.netfielders.de...
> Peter,
> Thank you for your response. I have seen a previous post by you in
> the archives that describes this procedure - I understand that
> count_menuItems is a temp register that is clobbered by every menu.
> As I mention, I have been unable to get LOAD_REGISTER to work in any
> way with the example code I posted. No matter what I try, the
> LOAD_REGISTER appears to either get no value or a random menu's value,
> no matter where I place it. If you believe this can be accomplished
> with LOAD_REGISTER, can you please explain how to modify my code to do
> so?
>
> On 2/25/06, Peter Klein <peter at umloud.dk> wrote:
> > Hi Surer. "count_menuItems" is a temp register value used by alle menus.
> > It
> > gets reset everytime you create a new menu object on the page.
> > What you need to do, is store the value of "count_menuItems" in your own
> > register variable. That way it doesn't get reset when you have more than 1
> > menu object.
> >
> > ---
> > Peter Klein / Umloud Untd
> >
> >
> > "Surer Dink" <surerlistmail at gmail.com> wrote in message
> > news:mailman.4258.1140853622.3122.typo3-english at lists.netfielders.de...
> > All,
> > For about 2 days I've been trying to figure out how to get a register
> > value into PAGE.headerData - to no avail. The problem is that there are
> > multiple menus on the page, and I want to get the count_menuItems from a
> > particular one. Everything I have tried with LOAD_REGISTER has failed.
> > The
> > code bellow works - however retrieves the incorrect menu's count (I want
> > to
> > get the count for nav.1, it appears to get the count for tree.1 - I have
> > no
> > idea why) [if there is a better way to do what I am trying, by all means
> > please enlighten me] Thank you.
> >
> > temp {
> > amenu = TMENU
> > amenu {
> > noBlur = 1
> > ACT=1
> > NO {
> > allWrap = <li>|</li>
> > stdWrap.htmlSpecialChars = 1
> > ATagParams = class="lb" |*| class="im"
> > }
> > ACT {
> > wrapItemAndSub = <li>|</li>
> > stdWrap.htmlSpecialChars = 1
> > ATagParams = class="lb active" |*| class="im active"
> > }
> > }
> > }
> >
> > lib {
> > nav = HMENU
> > nav {
> > entryLevel = 1
> > 1 < temp.amenu
> > 1.wrap = <ul id="nav">|</ul>
> > }
> > nav_width = TEXT
> > nav_width {
> > cObject = TEXT
> > cObject.dataWrap = 100/{register:count_menuItems}
> > prioriCalc = 1
> > wrap = <style type="text/css">/*<![CDATA[*/ ul#nav li { width: | %;
> > }/*]]>*/</style>
> > }
> > tree = HMENU
> > tree {
> > entryLevel = 2
> > 1 < temp.amenu
> > 1.wrap = <ul id="tree">|</ul>
> > 2 < temp.amenu
> > 2.wrap = <ul>|</ul>
> > }
> > }
> >
> > page = PAGE
> > page.headerData.1 < lib.nav_width
> > page.10 = USER
> > page.10.userFunc = tx_templavoila_pi1->main_page
> >
> >
> > _______________________________________________
> > TYPO3-english mailing list
> > TYPO3-english at lists.netfielders.de
> > http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
> >
>
>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>
More information about the TYPO3-english
mailing list