typo3 different title in second menu - typo3

i have to build an page with two menus. And in the second menu, i need different titles.
I had the idea to use the alternativ navigation-title. Is it possible to enable this in the first menu and disable in the second?
Thanks!

Yes you can do that by overwriting the stdWrap.cObject:
lib.menu1 = HMENU
lib.menu1.1 = TMENU
lib.menu1.1.NO = 1
lib.menu2 = HMENU
lib.menu2.1 = TMENU
lib.menu2.1.NO = 1
lib.menu2.1.NO.stdWrap.cObject = COA
lib.menu2.1.NO.stdWrap.cObject.10 = TEXT
lib.menu2.1.NO.stdWrap.cObject.10.field = nav_title // title
# = use nav_title field if available or title field as fallback
# also other fields are possible, e.g. subtitle

For your first menu set
NO.stdWrap.cObject = COA
NO.stdWrap.cObject {
10 = TEXT
10.field = title
and in your second menu
NO.stdWrap.cObject = COA
NO.stdWrap.cObject {
10 = TEXT
10.field = subtitle

Related

TYPO3 Special menu content element

I am working on TYPO3 6.2 and In a page I have added the content element "Special menu" with the the option Site map with selected page. I was able to render this with out any issues.For almost all pages I have added navigation title and obviously in the site map also this navigation title will be displayed.My requirement is that I want to show title instead of nav_title.Tried the below code and doesn't seems to work . Can any one help me with this?
tt_content.menu.20.2.1 {
NO {
stdWrap.cObject = COA
stdWrap.cObject {
10 = TEXT
10.field = subtitle
}
ATagTitle.field = subtitle
}
}
Any help would be appreciated.
Insert the following lines to the setup field of an ext-template at the page where you want to display the plugin "Special menu" with option "Site map" and wont to change link title to subtitle.
tt_content.menu.20.2 >
tt_content.menu.20.2 = HMENU
tt_content.menu.20.2.1 = TMENU
tt_content.menu.20.2.1 {
expAll = 1
wrap = <ul>|</ul>
NO{
wrapItemAndSub = <li>|</li>
stdWrap.htmlSpecialChars = 1
stdWrap.field = subtitle//title # add title of link subtitle or if empty title
ATagTitle.field = nav_title//title #title add tag title what you need
}
}
tt_content.menu.20.2.2 < tt_content.menu.20.2.1
tt_content.menu.20.2.3 < tt_content.menu.20.2.1
tt_content.menu.20.2.4 < tt_content.menu.20.2.1
Example http://www.typozone.com/index.php?id=96

TypoScript menu, with special treatment for specific pageIDs contained in list

Tearing my hair out over a TypoScript menu. I need the following behaviour:
A list of "special" menu items pageIDs is maintained in constant {$SPECIAL}
A HMENU is rendered showing the navigation of the site root. If the pageID is "special", then it gets a special div wrap, and a list of its child pages is nested inside of the div wrap. If the item is NOT "special", then it gets no special wrap, and no child pages are shown. All "special" items are shown at the top of the page list.
I've tried a couple of approaches:
Approach 1. Render two HMENUs, one after the other. First menu shows only {$SPECIAL}, second menu shows the siteroot, excluding the {$SPECIAL} items.
Problem: if I use special.directory to show {$SPECIAL}, the parent pages are not rendered. If I use special.list, the child pages are not rendered. Argh!
Approach 2. Render a big chunk of custom menu TS, using if conditions to check if the page is {$SPECIAL}
Problem: I can get the special wraps to show on {$SPECIAL} items, but I can't work out how to then render a list of the child pages specific to each item.
My code for Approach 2 is, so far:
MAIN_NAV.20 = HMENU
MAIN_NAV.20 {
special = directory
special.value = {$SITE_ROOT}
excludeUidList = {$RESTRICTED_ROOT}, {$HOME_SHORTCUT}
1 = TMENU
1{
NO{
# suppress standard menu output
doNotShowLink = 1
# build each menu item conditionally
stdWrap2.cObject = COA
stdWrap2.cObject{
#Standard
10 = TEXT
10{
# not in list of special pages?
if.value = {$NAV_CONTAINERS}
if.isInList.field = uid
if.negate = 1
field = nav_title//title
typolink.parameter.field = uid
wrap = <ul><li>|</li></ul>
}
#Special
20 = TEXT
20.wrap = <div class="SPECIAL"><ul><li><span>|</span>
20 {
if.value.field = uid
if.equals = {$SPECIAL}
field = nav_title//title
}
30 = TEXT
30.wrap = |</li></ul></div>
30 {
if.value.field = uid
if.equals = {$SPECIAL}
}
}
}
}
}
I can't hardcode this (like "Special item 1 as a text element, then Special item 1 children as a menu, then Special item 1 as a text element, then Special item 2 children...") because {$SPECIAL} could theoretically wind up being any number of pages.
Can anyone offer any suggestions to assist with one or other approach?
I think user Ila is right, if you use special = list, you should be able to add multiple levels (child pages) by adding TMENUs.
On the other hand, I've got a similar menu I'd like to share. It contains two kinds of special rendering cases - one with override.if and the other one with CASE.
temp.mainnav = HMENU
temp.mainnav {
wrap = <nav>|</nav>
entryLevel = 0
1 = TMENU
1 {
noBlur = 1
expAll = 1
wrap = <ul>|</ul>
NO {
wrapItemAndSub=<li class="p{page:uid}">|</li>
wrapItemAndSub.insertData = 1
}
}
2 = TMENU
2 {
noBlur = 1
expAll = 1
NO {
wrapItemAndSub=<li>|</li>
// http://labor.99grad.de/2013/07/10/typo3-hmenu-einen-menupunkt-anders-darstellen/
doNotLinkIt.override = 1
doNotLinkIt.override.if {
value = {$pidsDoNotLinkInMenu}
isInList.field = uid
}
stdWrap.wrap.override = <p class="unlinkedMenuItem">|</p>
stdWrap.wrap.override.if {
value = {$pidsDoNotLinkInMenu}
isInList.field = uid
}
}
}
3 = TMENU
3 {
noBlur = 1
expAll = 1
wrap = <ul class="level3">|</ul>
NO.wrapItemAndSub.cObject = CASE
NO.wrapItemAndSub.cObject {
//http://stackoverflow.com/questions/18899573/how-to-apply-a-different-wrap-in-a-tmenu-for-certain-items-only/18910302?noredirect=1#18910302
key.field = uid
// normal item
default = TEXT
default.value = <li class="level3">|</li>
// special item
{$somePid} = TEXT
{$somePid}.value = <li class="level3 foo">|</li>
{$somePid}.append < temp.sometemp
// some other special item
{$someOtherpid} = TEXT
{$someOtherpid}.value = <li class="level3 bar">|</li>
{$someOtherpid}.append < temp.someothertemp
}
}
}
I think both approaches could be used to achieve your goal.

Subpage Links with image and text

I try to implement a page which contains images to certain subpages. For each subpage, I have a seperate image. I want to display for each subpage the appropriate image "galerie_XX.png" an show the name of the subpage above the image. So far I got:
galerielabel = HMENU
galerielabel.special = directory
galerielabel{
1 = TMENU
1.NO.stdWrap{
wrap = <img src="fileadmin/templates/images/galerie/galerie_|.png" />
}
}
The Subpages are year names, like 2012, 2013... This script shows me the required images as a link.
My question is, how can I add the name of the subpages above the image?
Thank you in advance.
I suggest a different approach.
You can add images in the page properties.
Then, your menu could be like this:
lib.menu = COA
lib.menu.10 = HMENU
lib.menu.10 {
10 = HMENU
10.1 = TMENU
10.1.NO.doNotShowLink = 1 #will remove the link altogether
10.1.NO.before.cObject = COA
10.1.NO.before.cObject {
10 = TEXT
10.field = title #title of the page, change to any field you like
20 = IMAGE
20.file.import = uploads/media/ #4.x style
20.file.import.field = media
20.file.import.listNum = 0 #use first image referenced
20.width = 200 #set to imagesize of your liking
30 = TEXT
30.value = Do what you like here
}
}
Untested: the title of the page should be prepended
galerielabel = HMENU
galerielabel.special = directory
galerielabel{
1 = TMENU
1.NO.stdWrap{
# Prepend with page.title
prepend = TEXT
prepend {
field = title
htmlSpecialChars = 1
}
wrap = <img src="fileadmin/templates/images/galerie/galerie_|.png" />
}
}

Typoscript menu jump to subpage

I want to create a menu with submenu, that's quiet straight forward via typoscript. The challenge is, that I want the parent levels to link directly to the first subpage if the content of the containing page is empty.
I know you can achieve that via shortcut links in the backend, but I want to, if possible, achieve that via typoscript.
Any ideas? I enclode the typoscript menu code I currently use.
lib.mainMenu = COA
lib.mainMenu{
10 = HMENU
10{
# Level 1, further levels are generic
1 = TMENU
1.noBlur = 1
1.expAll = 0
1.wrap = <ul data-role="listview" data-inset="true">|</ul>
1.NO = 1
1.NO.ATagBeforeWrap = 1
1.NO.insertData = 1
1.NO.wrapItemAndSub.insertData = 1
1.NO.wrapItemAndSub = <li id="menu_{field:uid}">|</li>
1.NO.ATagTitle.field = subtitle // title
1.ACT = 1
1.ACT.ATagBeforeWrap = 1
1.ACT.wrapItemAndSub.insertData = 1
1.ACT.wrapItemAndSub = <li id="menu_{field:uid}" class="active">|</li>
1.ACT.ATagTitle.field = subtitle // title
1.CUR = 1
1.CUR.ATagBeforeWrap = 1
1.CUR.wrapItemAndSub.insertData = 1
1.CUR.wrapItemAndSub = <li id="menu_{field:uid}" class="active">|</li>
1.CUR.ATagTitle.field = subtitle // title
}
20 < .10
20.entryLevel = 1
20.1.wrap = <ul data-role="listview" data-inset="true">|</ul>
30 < .20
30.entryLevel = 2
40 < .20
40.entryLevel = 3
}
Maybe you can build your solution based on hints from here:
http://typo3-blog.net/tutorials/news/if-funktionen-in-typo3.html
In the example from the link above, it's not a menu, but there's a subquery on a table (in your case tt_content) which will then be used to define if something's output or not:
temp.main = COA
temp.main.20 = COA
temp.main.20 {
[...]
wrap=<div class="meine-adressen">|</div>
stdWrap.if.isTrue.cObject = CONTENT
stdWrap.if.isTrue.cObject{
table = tt_address
select {
[...]
}
renderObj = TEXT
renderObj.value = 1
}
}
temp.main.21 = TEXT
temp.main.21 {
wrap=<div class="keine-adressen">|</div>
value = Keine Adressen gefunden
stdWrap.if.isFalse.cObject < temp.main.20.stdWrap.if.isTrue.cObject
}
But I'm not sure if this wouldn't give you headaches in a HMENU
I think it is possible using typoscript, but I dont know how to do it.
The below typoscript may help you:
Typoscript to find the number of content elements in a page:
lib.emptypage = CONTENT
lib.emptypage{
table = tt_content
select{
selectFields = count(uid) AS count
pid = id
}
renderObj = COA
renderObj {
10 = TEXT
10 {
value = {field:count}
insertData = 1
}
}
wrap = |
}
If count is equal to zero, then the page is empty.
Typoscript to get the first subpage:
lib.firstsubpage= HMENU
lib.firstsubpage {
maxItems = 1
1 = TMENU
1 {
NO = 1
}
}
Please share your typoscript solution after implementing it.

HMENU with graphics

In a TYPO3 site, I have a list of sibling pages. Each page has some images in the "media" field. Im trying to make a navigation to go to the previos/next sibling. So far I have this:
# Append Sitenavi for projects
[PIDupinRootline = 43]
page.10.marks.MAIN.20 = HMENU
page.10.marks.MAIN.20{
special = browse
special{
items = next|prev
}
1 = TMENU
1{
NO = 1
}
}
[global]
But instead of using the page title, id like to use the first image from the "files" field. How could I do it?
This is the way to get other fields:
page.10.marks.MAIN.20 = HMENU
page.10.marks.MAIN.20 {
special = browse
special {
items = prev | next
}
1 = TMENU
1 {
NO = 1
NO.stdWrap.field = subtitle // title
}
}
Now if your change subtitle // title to image and add NO.stdWrap.wrap = <img src"|" />, then it should work.