Discussion:
[TYPO3-english] Custom class in tmenu according to uid page
Marieke Vandamme
2010-02-22 11:17:02 UTC
Permalink
Hello,

I would like to put a specific class according to the uid from the page.

My menu should look like this:
<div class="corporate"></div> # Corporate
<div class="hr"></div> # HR
<div class="knowledge"></div> # Knowledge
..

My typoscript:
temp.myMenu = HMENU
temp.myMenu .1 = TMENU
temp.myMenu .1 {
NO.linkWrap = <div class="???"></div>|
}

Thanks for helping me to fill in the "???" ! Marieke
--
View this message in context: http://old.nabble.com/Custom-class-in-tmenu-according-to-uid-page-tp27685784p27685784.html
Sent from the TYPO3 English mailing list archive at Nabble.com.
Victor Livakovsky
2010-02-22 13:06:10 UTC
Permalink
Post by Marieke Vandamme
Hello,
I would like to put a specific class according to the uid from the page.
<div class="corporate"></div> # Corporate
<div class="hr"></div> # HR
<div class="knowledge"></div> # Knowledge
..
temp.myMenu = HMENU
temp.myMenu .1 = TMENU
temp.myMenu .1 {
NO.linkWrap = <div class="???"></div>|
}
Thanks for helping me to fill in the "???" ! Marieke
Hi.

You may try to play with cObject of menu item:
temp.myMenu = HMENU
temp.myMenu .1 = TMENU
temp.myMenu .1 {
NO.allWrap.cObject = CASE
NO.allWrap.cObject {
key = id
default = TEXT
default.value = <div class="default"> | </div>
# id of 'Corporate' page
23 = TEXT
23.value = <div class="corporate">|</div>
...
}
}

I've not tried this snippet, but at least you now have point to start with
;)
Marieke Vandamme
2010-02-22 14:49:55 UTC
Permalink
Using:
key.field = uid
it works! Thanks a lot!
Post by Marieke Vandamme
Post by Marieke Vandamme
Hello,
I would like to put a specific class according to the uid from the page.
<div class="corporate"></div> # Corporate
<div class="hr"></div> # HR
<div class="knowledge"></div> # Knowledge
..
temp.myMenu = HMENU
temp.myMenu .1 = TMENU
temp.myMenu .1 {
NO.linkWrap = <div class="???"></div>|
}
Thanks for helping me to fill in the "???" ! Marieke
Hi.
temp.myMenu = HMENU
temp.myMenu .1 = TMENU
temp.myMenu .1 {
NO.allWrap.cObject = CASE
NO.allWrap.cObject {
key = id
default = TEXT
default.value = <div class="default"> | </div>
# id of 'Corporate' page
23 = TEXT
23.value = <div class="corporate">|</div>
...
}
}
I've not tried this snippet, but at least you now have point to start with
;)
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
--
View this message in context: http://old.nabble.com/Custom-class-in-tmenu-according-to-uid-page-tp27685787p27688383.html
Sent from the TYPO3 English mailing list archive at Nabble.com.
Peter Russ
2010-02-22 15:35:06 UTC
Permalink
--- Original Nachricht ---
Absender: Marieke Vandamme
Post by Marieke Vandamme
key.field = uid
it works! Thanks a lot!
Hardcoded break point....
This would be the first site where uids didn't change.
It might take 2 more minutes to get a flexible solution.
But would be worth, i.e. less trouble.


jm2c. Peter
Victor Livakovsky
2010-02-22 16:17:21 UTC
Permalink
Post by Peter Russ
--- Original Nachricht ---
Absender: Marieke Vandamme
Post by Marieke Vandamme
key.field = uid
it works! Thanks a lot!
Hardcoded break point....
This would be the first site where uids didn't change.
It might take 2 more minutes to get a flexible solution.
But would be worth, i.e. less trouble.
Yes, that's not perfect, but what would you propose for making concrete page
be wrapped with certain class? OptinSplit not a solution, because page can
appear anywhere in menu.
You mentioned something about alias. Can you explain, please?
Peter Russ
2010-02-22 16:28:58 UTC
Permalink
--- Original Nachricht ---
Absender: Victor Livakovsky
Post by Victor Livakovsky
Post by Peter Russ
--- Original Nachricht ---
Absender: Marieke Vandamme
Post by Marieke Vandamme
key.field = uid
it works! Thanks a lot!
Hardcoded break point....
This would be the first site where uids didn't change.
It might take 2 more minutes to get a flexible solution.
But would be worth, i.e. less trouble.
Yes, that's not perfect, but what would you propose for making concrete
page be wrapped with certain class? OptinSplit not a solution, because
page can appear anywhere in menu.
You mentioned something about alias. Can you explain, please?
There is a field called alias in the page properties. It can be used for
simulate static contend to get an URL different from the page title.

So if simulate static is not used (e.g. due to realurl) this field could
be used to provide a classname instead.

quick draft:
NO.outerWrap.cObject = COA
NO.outerWrap.cObject {
10 = TEXT
10 {
field = alias
wrap=<div class="|">
}
20 = TEXT
20.value=|</div>
}

should work so or similar

Peter.
--
loans that change lives http://www.kiva.org

_____________________________
uon GbR
http://www.uon.li
http://www.xing.com/profile/Peter_Russ
Victor Livakovsky
2010-02-22 16:39:46 UTC
Permalink
Post by Peter Russ
Post by Victor Livakovsky
Post by Peter Russ
Hardcoded break point....
This would be the first site where uids didn't change.
It might take 2 more minutes to get a flexible solution.
But would be worth, i.e. less trouble.
Yes, that's not perfect, but what would you propose for making concrete
page be wrapped with certain class? OptinSplit not a solution, because
page can appear anywhere in menu.
You mentioned something about alias. Can you explain, please?
There is a field called alias in the page properties. It can be used for
simulate static contend to get an URL different from the page title.
So if simulate static is not used (e.g. due to realurl) this field could
be used to provide a classname instead.
NO.outerWrap.cObject = COA
NO.outerWrap.cObject {
10 = TEXT
10 {
field = alias
wrap=<div class="|">
}
20 = TEXT
20.value=|</div>
}
should work so or similar
Ah, that's nice! Never thought about such possibility.
Thank you for an explanation :)
Christopher Torgalson
2010-02-22 18:41:10 UTC
Permalink
Hello,
Post by Victor Livakovsky
Post by Peter Russ
Post by Victor Livakovsky
Post by Peter Russ
Hardcoded break point....
This would be the first site where uids didn't change.
It might take 2 more minutes to get a flexible solution.
But would be worth, i.e. less trouble.
Yes, that's not perfect, but what would you propose for making concrete
page be wrapped with certain class? OptinSplit not a solution, because page
can appear anywhere in menu.
You mentioned something about alias. Can you explain, please?
There is a field called alias in the page properties. It can be used for
simulate static contend to get an URL different from the page title.
So if simulate static is not used (e.g. due to realurl) this field could
be used to provide a classname instead.
NO.outerWrap.cObject = COA
NO.outerWrap.cObject {
10 = TEXT
10 {
field = alias
wrap=<div class="|">
}
20 = TEXT
20.value=|</div>
}
should work so or similar
Ah, that's nice! Never thought about such possibility.
Thank you for an explanation :)
Rather than introducing a whole new div, you could also use either of:

### Add a class to the link:
NO.ATagParams.dataWrap = class="{field:alias}"

...or...

### Add a class to the list-item:
NO.wrapItemAndSub.dataWrap = <li class="{field:alias}">|</li>

Also, since the alias field's contents should be unique, you could
output it as an id instead of a class if that suits your use-case.
--
Christopher Torgalson
http://www.typo3apprentice.com/
Peter Russ
2010-02-22 13:10:14 UTC
Permalink
--- Original Nachricht ---
Absender: Marieke Vandamme
Post by Marieke Vandamme
Hello,
I would like to put a specific class according to the uid from the page.
<div class="corporate"></div> # Corporate
<div class="hr"></div> # HR
<div class="knowledge"></div> # Knowledge
..
temp.myMenu = HMENU
temp.myMenu .1 = TMENU
temp.myMenu .1 {
NO.linkWrap = <div class="???"></div>|
}
Thanks for helping me to fill in the "???" ! Marieke
If you are not using alias so far you could use this to provide the
class on top level object.

Does that help?

Peter.
--
loans that change lives http://www.kiva.org

_____________________________
uon GbR
http://www.uon.li
http://www.xing.com/profile/Peter_Russ
Loading...