I'm stuck in a TS problem related to a special browse HMENU. I'm using TYPO3 7.6.11.
Site Structure:
/ Page 1
// Page 1.1
// Page 1.2
// Page 1.3
/ Page 2
/ Page 3
I'd like to integrate a Previous / Next navigation for the first navigation level. On Page 1, you can switch to Page 2. On Page 2, you can switch to Page 1 or Page 3. I used following code and it works on the first level:
lib.newsletter = COA
lib.newsletter {
10 = HMENU
10 {
special = browse
special {
items = prev
}
1 = TMENU
1 {
NO.ATagParams = class="prev"
}
}
20 < .10
20 {
special.items = next
1.NO.ATagParams = class="next"
}
}
When I open a page of the second level, I'd still like to browse on the first level. So when I'm on Page 1.2 and click on the "Next" button, "Page 2" should open.
I've tried to set an entry level in combination with a treeLevel condition but the entryLevel has no effect.
Do you have an idea? Your help is really appreciated.
Thanks in advance,
Tom
entryLevel won't work here because it's relative to the current page. You can however set .special.value to another page id to make it relative to that page. This property supports stdWrap so you can be creative with things like
.special.value.data = leveluid:1 (page in first level of the root line)
See TypoScript reference
Related
It is not a bug, of course, but i cant figure out how to solve it.
With previous version of News there was all fine.
Sorry for my language, it hard to explain.
Current Behavior
For example - I have this page title behaivor for the first time news detail page visit -
"SiteName: Some NewsRecord Title" (this is fine, how it should be).
Then when i go to list view, and again click on news to view it in detail (or just refresh the page I'm currently viewing) - page title gets look like this:
"SiteName: news" where "news" is a page title in the backend page tree, that contains newsDetailView plugin
To override this strange behavior, i use such typoscript setup (But this should not be a permanent solution to the problem, of course)
[globalVar = TSFE:id = 7]
config.noPageTitle = 2
temp.newsTitle = RECORDS
temp.newsTitle {
dontCheckPid = 1
tables = tx_news_domain_model_news
source.data = GP:tx_news_pi1|news
source.intval = 1
conf.tx_news_domain_model_news = TEXT
conf.tx_news_domain_model_news {
field = title
htmlSpecialChars = 1
}
wrap = <title>SiteName: |</title>
}
page.headerData.1 >
page.headerData.1 < temp.newsTitle
[global]
Environment
TYPO3 version(s): [9.5.15]
news version: [8.0.0]
Composer (Composer Mode): [no]
With 9.5 and the nice SEO extension you really shouldn't do such stuff anymore. Don't use config.noPageTitle and it should work out of the box as the news extension will set the title just right.
My goal is to apply different navigation logic to different page types. For example shortcut type will be container (drop down list in FE, shortcut itself is dummy link), standard type - page with content that you can navigate to. So, when in FE navigation user selects page:
drop-down list appears
if (type of page in list == standard)
can navigate to page in list;
else if (type of page in list == shortcut)
GO TO drop-down list appears
I know that you can do something like this:
lib {
main-nav = HMENU
main-nav {
1 = TMENU
1 {
expAll = 1
NO = 1
NO.wrapItemAndSub = <li>|</li>
NO.stdWrap.cObject = CASE
NO.stdWrap.cObject {
key.field = doktype
default = TEXT
default {
field = title
}
# standard page type
1 = TEXT
1 {
field = title
wrap = <div>|</div>
}....
As a result you get page title wrapped with div if page type is standard.
But what do i need to do to wrap whole menu item rather then just wrapping title?
If it's just about putting the div around the whole submenu, I guess what you already got should be applied to wrapItemAndSub instead
lib {
main-nav = HMENU
main-nav {
1 = TMENU
1 {
expAll = 1
NO = 1
NO.wrapItemAndSub.cObject = CASE
NO.wrapItemAndSub.cObject {
key.field = doktype
default = TEXT
default {
value = <li>|</li>
}
# standard page type
1 = TEXT
1 {
value = <li><div>|</div></li>
}....
I think you need to combine HTML, CSS and javascript.
In the typoscript you prepare the HTML with different markup depending on page type. Then your javascript has to handle the click event in case of a shortcut page where a click should open a drop down instead of going to that page. (add eventhandler)
So you need to give javascript something to identify the shortcut pages.
With the CASE object you mentioned you can build the apropiate HTML with all neccessary information (you might use data- attributes).
For a more detailed help you need to be more specific what you want to achieve.
I am trying to display all pages in the root level inside my menu.
I use:
special = list
special.value = 1, 2, 3, 4
This displays all my current pages but when adding new pages I will have to manually add them in the code.
Is there a way to automatically display all the pages in my root level?
In general you would use no special in your menu.
temp.mainMenu = HMENU
temp.mainMenu {
1 = TMENU
1 {
NO {
:
}
ACT {
:
}
}
}
this will render the main menu on top level.
if you have one root page and the mainmenu consists of the pages one level deeper you might vary it with
temp.mainMenu.entryLevel = 1
Have a look into the documentation for further options.
This can also be done using
special = directory
special.value = 1
Where 1 is the root page, every subpage under that page will be displayed.
Hope this helps.
I already searched the whole internet for a solution but didn't find the right answer, so here is my question:
I have been trying to introduce a breadcrumb menu inside my website. I've done this by writing the following HMENU:
lib.breadcrumb=COA
lib.breadcrumb {
10 = HMENU
10 {
special = rootline
special.range = 1|-1
includeNotInMenu = 1
1 = TMENU
1 {
# no unneccessary scripting.
1.noBlur = 1
# Current item should be unlinked
1.CUR = 1
1.target = _self
1.wrap = <div class="breadcrumb"> | </div>
1.NO {
stdWrap.field = title
ATagTitle.field = nav_title // title
linkWrap = ||*| » |*|
}
# Current menu item is unlinked
1.CUR {
stdWrap.field = title
linkWrap = ||*| » |*|
doNotLinkIt = 1
}
}
}
}
The menu is showing on the website so the wiring is working fine. But the problem is, despite all sites have the common root site Home in backend hierarchie, the root isn't shown at all sites. Here is an concrete example of two different sites with the same site hierarchie tree returning different breadcrumbs:
Backend-Site-Tree:
Home----Referenzen-----Vertriebsplattform
\---Kompetenzen----Schnittstellentechnik
edit:
Breadcrumbs:
I searched for differences in site configuration, but negative report. I also reset caches multiple times.
Does anybode have a similar problem or have an idea what could be wrong?
Thanks in advance,
Thomas
take this:
special = rootline
special.range = 1
After many hours of research I found the reason why the breadcrumb didn't appear properly.
All the sites on the second level of the hierarchie use the same template (another one than the home site). But those of them which didn't show Home as part of their breadcrumb also mistakenly included the template of the home site as basic template. This has to be a remnant of earlier stages of development :(
I don't know exactly why the breadcrumb menu was affected by this but the problem disappeared after fixing this dependency.
Anyways thanks for all your answers and suggestions.
I have a website with some pages, presented in a normal menu. Every page has subpages and shows them in a submenu. Except one page. This page has no subpages and should have a content menu which navigates to different content sections on the page. The thing with the content navigation is done with:
temp.contentnav = CONTENT
temp.contentnav {
table = tt_content
select {
pidInList = 7
orderBy = sorting
where = colPos=0
languageField=sys_language_uid
}
renderObj = TEXT
renderObj {
field = header
wrap= <li>|</li>
typolink.parameter.field=pid
typolink.parameter.dataWrap=|#{field:uid}
typolink.ATagParams = class="linkSubpage"
if.isTrue.field=header
}
wrap = <ul id="subMenu"> | </ul>
}
page.10.marks.MENU.2a.NO.after.cObject < temp.contentnav
but this works only if the page has at least one subpage. The workaround would be to add a subpage and hide the submenulink, but is there a better solution to show the custom submenu without adding subpages?
Use a HMENU item with the levels to generate your submenu.
Your behavior is not the right one in the TYPO3 working style. Use the rights TypoScript objects.
And remove the "a" from the "page.10.marks.MENU.2a.NO". The correct use is 1,2,3,...
http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/CommonProperties/Index.html
http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/CommonItemStates/Index.html
http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/Tmenu/Index.html
http://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/Tmenuitem/Index.html