How to setup a browse menu to cycle a page and it's sub pages only in typo3? - typo3

I am trying to set up a browse menu to cycle a page and it's sub pages. I have to have it in the format of < 2 > where < is the previous page, 2 is the current page, and > is the next page. To reslove this I decided to put an extension template on the parent page which in which a browse menu points to the first page of the sub page tree:
lib.pagenumber = HMENU
lib.pagenumber{
special = browse
special.items = | next
special.next.uid = 100
special.next.fields.title = 2
1 = TMENU
1{
noBlur = 1
expAll = 0
NO = 1
NO.ATagTitle = 1
NO.before = <div id="currLGMpg" class= "currpg">1</div>
NO.linkWrap = <div class=nextLGMpg>|</div>
}
}
The current page is not linked but just an image box which has to be between the prev and next links and also be auto numbered. this is the second problem I am trying to solve.
For the subpages I am thinking that a template on the first subpage with option split on the linkwrap would work for styling the prev and next links but I have no idea how to put the image for the current page in the middle.

Hello for cycling you should follows the below steps this only for next please follow same steps for prev.
temp.lightbox_navi.30 = HMENU
temp.lightbox_navi.30 {
stdWrap.wrap = <li>|</li>
special = browse
special {
items = next
items.prevnextToSection = 0
next.fields.title = < next Projekt
}
1 = TMENU
1 {
NO = 1
}
stdWrap.ifEmpty.cObject = HMENU
stdWrap.ifEmpty.cObject {
special = browse
special {
items = first
items.prevnextToSection = 0
first.fields.title = < next Projekt o
}
1 = TMENU
1 {
NO = 1
}
}
}

So I finally solved all but one issue. which is to auto number the page. For those interested, you need to map the next and prev separately to so that you can put a page number button inbetween. The following typoscript code sits on the root page tree of the pages you want to setup browse buttons for:
#Next page button setup
lib.nextpage = HMENU
lib.nextpage.special = browse
lib.nextpage.special.items = next
#can't remove the page title some reason it just gets inserted back so we set it to nothing
lib.nextpage.special.next.fields.title =
#if we're on the parent page of the page tree we wish to browse next should point to the first page of the subtree.
[globalVar = TSFE:id = 46]
lib.nextpage.special.next.uid = 100
[global]
lib.nextpage.1 = TMENU
lib.nextpage.1{
noBlur = 1
expAll = 0
NO = 1
#NO.ATagTitle = 1
NO.linkWrap = <div class=nextLGMpg>|</div>
}
#Page number
lib.currpage = TEXT
#can't autonumber yet so put a 1 as a placeholder for the current page number
lib.currpage.value = 1
lib.currpage.wrap = <div id="currLGMpg">|</div>
#previous page button setup
#copy from next page setup; tbh all we gain is 1 less line code
lib.prevpage < lib.nextpage
lib.prevpage.special.items = prev
lib.prevpage.special.prev.fields.title =
#again if we're at the 1st subpage we need to target the parent page as that is page one.
[globalVar = TSFE:id = 100]
lib.prevpage.special.prev.uid = 46
#next line tests to see if we're at page 1. If we are we remove the prev object because browsing stops here.
[globalVar = TSFE:id = 46]
lib.prevpage >
[global]
lib.prevpage.1 = TMENU
lib.prevpage.1{
noBlur = 1
expAll = 0
NO = 1
#NO.ATagTitle = 1
NO.linkWrap = <div class=prevLGMpg>|</div>
}
Once I figure out how to autonumber I will update the answer.

Related

Typo3 Breadcrumb with stdWrap.data possible?

I am new to Typo3 and wanted to have something like this: date / page1 > page2 > page3...
I know how to make a simple breadcrumb but now I wonder how I can put the current date in front of it. When I try the stdWrap.data + stdWrap.dataWrap the breadcrumb doesn't show.
20 = HMENU
20 {
special = rootline
special.range = 0 | -1
stdWrap.data = date : d.m.Y :::
stdWrap.dataWrap = <p> | </p>
//wrap = <p> | </p>
1 = TMENU
1 {
NO = 1
NO.allWrap = | >
CUR = 1
CUR.allWrap = |
}
}
Currently I don't know if I had to write to objects in typoscript for it or if I could do it in once like I tried. Maybe you can hint me to something or explain a simple way. Thanks!
You need to do a proper wrapping.
20.stdWrap.data
is no wrap at all and will be ignored so you might only get an empty p-tag from the stdWrap.dataWrap.
Following your attempt I think you want something like:
20.dataWrap = <p>{date:d.m.Y}</p> |
so I don't get it why you use a p tag to get all in one line.
I would propose a different TypoScript:
lib.breadcrumb = COA
lib.breadcrumb {
stdWrap.wrap = <ul>|</ul>
10 = TEXT
10 {
wrap = <li>|</li>
data = date : U
strftime = %A, %e. %B %Y
}
20 = HMENU
20 ... your TS for the breadcrumb menu
}

hide page & subpages from menu

I have the following page structure in TYPO3:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
Now I want to have 1/* + 4/* included in the header menu and 4/* + 7/* in the footer menu. Since the header and footer menus are different, I cannot just use the "hide in menu" feature and need to do it in TypoScript instead.
Here's what I have so far:
HEADERMENU = HMENU
HEADERMENU {
1 = TMENU
1.expAll = 1
1.NO = 1
1.NO {
stdWrap.if.value.field = uid
stdWrap.if.equals = 7
stdWrap.if.negate = 1
}
2 < .1
}
FOOTERMENU < HEADERMENU
FOOTERMENU.1.NO.stdWrap.if.equals = 1
The problem with this is, that it still displays the pages 8+9 in the header and 2+3 in the footer, even if it does not display page 1/7 anymore. I know that I could use if.isInList and the provide all subpage IDs, but then I'd have to change the TypoScript everytime I add a new page. If possible, I'd like to dynamically exclude a page and all its subpages.
How can I do that?
As Daniel mentioned in his answer there is a way to display all subpages of the selected pages. special = directory displays however only the subpages. So you could see only 2/3 and 5/6 and 8/9 in your menus.
special = directory
"This will generate a menu of all pages with pid = 35 and pid = 56."
I would suggest the excludeUidList property.
HEADERMENU = HMENU
HEADERMENU {
excludeUidList = 7
1 = TMENU
1.expAll = 1
2 < .1
}
FOOTERMENU < HEADERMENU
FOOTERMENU.excludeUidList = 1
It is working as a WHERE condition in a db SELECT query, so you won't get those pages on the first level and neither will it find their subpages then.
You could go for the special=directory approach to render a Menu of one or more pages and their subpages.
HEADERMENU.special = directory
HEADERMENU.special.value = 1, 4
More information in the documentation.

Typoscript Menu: if "directory" list is empty then use "entrylevel"

I use the Special Menu element "Menu of sub pages of selected pages".
I would like to modify it so that it shows a sitemap of the sub pages of the current page if there are no entry pages defined - otherwise it should work as usually.
I've tried to overwrite the element like this - but I have no idea how to do the condition for changing from directory to entrylevel.
menu.sub < menu.template // A standard TMENU template
menu.sub {
special = directory
special.value.field = pages
#entryLevel= -1 ***USE THIS IF THE special value ABOVE IS EMPTY***
1.expAll = 1
1.wrap = <ul class="subnav">|</ul>
2.expAll = 1
2.wrap = <ul>|</ul>
3 < .2
}
tt_content.menu.20.1 < menu.sub

TYPO3 excludeUidList is there an includeUidList

Have search the net, for a solution where i have a navi TS file that show a Menu.
here i only want to show 2 links, the links are a Main root page and a sub page, so my question is.
If i dont want to excludeUidList all the 7-9 Uid, is there a way to make a includeUidList ?
bc i can't get this to work, it showing all the Uid links.
lib.leftNavi = HMENU
lib.leftNavi.entryLevel=0
lib.leftNavi.includeUidList = 4,8
lib.leftNavi.1 = TMENU
lib.leftNavi.1 {
wrap = <div id="leftMenu"><ul class="L1"><li><ul>|</ul></li></ul></div>
expAll = 0
NO = 1
NO.allWrap = <li>|</li>
NO.stdWrap.wrap = <span>|</span>
RO < .NO
RO = 1
CUR < .NO
CUR = 1
CUR.allWrap = <li class="current">|</li>
CUR.stdWrap.wrap = <span>|</span>
CUR.ATagParams =
ACT < .CUR
}
No, there is no includeUidList, see the reference at http://docs.typo3.org/typo3cms/TyposcriptReference/latest/ContentObjects/Hmenu/.
But you can use a HMENU with the "special" property: http://docs.typo3.org/typo3cms/TyposcriptReference/latest/ContentObjects/Hmenu/#hmenu-special-property
20 = HMENU
20.special = list
20.special.value = 35, 56
This will generate a menu with page 35 and 36.

tt_news in Menu

In need to create a special and complicated menu. It should display in the Level 2 all sub-page with the latest news of their parent page (level 1) (I used tt_news and I created news for each page level 1). Here is my source code, it is composed of two parts, it shows in all level2 menu juste only the news of the first parent page(level 1).
The first part:
lib.var1 < plugin.tt_news
lib.var1 {
code >
code = LATEST
templateFile= fileadmin/news_template.tmpl
categoryMode = 0
pid_list >
pid_list.insertData = 1
pid_list = {data:pid}
catImageMode = 1
catTextMode = 0
latestLimit = 1
}
The second part:
lib.field_menu= HMENU
lib.field_menu {
entryLevel = 0
### first level ###
1 = TMENU
1 {
noBlur = 1
expAll = 1
wrap = |
NO = 1
NO {
allWrap = |
ATagTitle.field = title
}
}
### secondary Level ###
2 = TMENU
2 {
noBlur = 1
stdWrap.wrap = <ul style=""><li> | </li></ul>
stdWrap.innerWrap = <div><ul>|</ul></div>
stdWrap.innerWrap2.preCObject =< lib.var1
NO = 1
NO {
linkWrap= <li class="">|</li>
ATagTitle.field = title
}
}
}
}
Try:
pid_list >
pid_list = TEXT
pid_list.insertData = 1
pid_list.data = field : pid
instead if {data:pid}.