I've got a TYPO3 page (6.2.31) and want to make the root node actvie in typoscript. roodnode is the globe.
my typoscript looks like this at the moment:
NAVIMAIN = HMENU
NAVIMAIN.entryLevel = 0
#NAVIMAIN.excludeUidList =
NAVIMAIN {
1 = TMENU
1 {
expAll = 1
wrap = <ul class="sf-menu">|</ul>
noBlur = 1
NO = 1
NO.ATagTitle.field = title
NO.wrapItemAndSub = <li>|</li>
ACT = 1
ACT.wrapItemAndSub = <li class="active"> |</li>
}
2 = TMENU
2 {
expAll = 1
maxItems = 10
wrap = <div class="sf-mega">|</div>
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <div class="sf-mega-section">|</div>
stdWrap.wrap = |
ATagParams = class="headermega"
stdWrap.htmlSpecialChars = 1
doNotLinkIt = 0
}
}
3 = TMENU
3 {
expAll = 1
maxItems = 20
wrap = <ul>|</ul>
NO = 1
NO {
ATagTitle.field = title
linkWrap = <li>|</li>
}
ACT = 1
ACT {
wrapItemAndSub = <li>|</li>
ATagParams = class="active"
}
}
#4 < .3
}
All other pages are marked as aktive. only the rood node not.
root node is the globe, there is one link (third) that redirects to root node
Whats my problem?
Thanks
I suppose you want the menu item (which links to your root node) stated as active.
With the TypoScript option alwaysActivePIDlist and a condition you can do that.
Example:
[globalVar = TSFE:id = <page uid of root node>]
NAVIMAIN.alwaysActivePIDlist = <page uid you want to set as active>
[global]
Related
TYPO3 - Sidebar navigation li has no 'active' class when on page (active/current). I have this sidebar navigation ... but the li has no active added when on a specifc page. Does anybody see what's wrong?
lib.navigation = COA
lib.navigation {
20 = HMENU
20 {
entryLevel = 1
1 = TMENU
1 {
expAll = 1
#collapse = active
wrap = <ul class="sidebar-nav" id="menu">|</ul>
NO {
subst_elementUid = 1
ATagBeforeWrap = 1
allStdWrap.insertData = 1
wrapItemAndSub = <li>|</li>
}
ACT <.NO
ACT.wrapItemAndSub = <li class="active">|</li>
CUR <.ACT
#CUR <.NO
#CUR = 1
CUR.wrapItemAndSub = <li class="active">|</li>
#CUR.linkWrap = <strong>|</strong>
...
}
....
}
}
Try adding ACT = 1. Unlike NO, ACT and CUR are not active by default.
See https://docs.typo3.org/typo3cms/TyposcriptReference/MenuObjects/CommonItemStates/Index.html for more information about this.
i am currently working on a project that requires two languages. For example German (L=0) and Leicht German (L=1).
My goal is, when there is a translation available on the German page to Leicht German, a button will appear and redirect the user to the Leicht German language. So far so good it works.
But, when you are on the Leicht German version and you want to move to another page where no Leicht German translation is available, by clicking on the submenu and not the button itself, the URL stays on the L=1 and it doesn't go back to L=0.
I would like your knowledge on this matter cause i am run out of ideas.
Here is my code:
config {
linkVars = L(0-1)
uniqueLinkVars = 1
defaultGetVars.L = 0
sys_language_uid = 0
sys_language_overlay = 1
language = de
locale_all = de-DE
}
[globalVar = GP:L = 1]
config {
sys_language_uid = 1
language = leichte Sprache
locale_all = de_DE.UTF-8
htmlTag_setParams = lang="ls" dir="ltr" class="no-js" }
[global]
This is my list where when you click you redirect to the Leicht German and backwards.
lib.language = COA
lib.language {
20 = HMENU
20 {
special = language
special.value = 0,1
special.normalWhenNoLanguage = 0
wrap = <ul class="languageMenu">|</ul>
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
linkWrap = <li>|</li>
stdWrap.override = Deutsch || Leichte Sprache
stdWrap {
typolink {
parameter.data = page:uid
additionalParams = &L=0 || &L=1
ATagParams = hreflang="de-DE" || hreflang="de-LS"
addQueryString = 1 addQueryString.exclude = L,id,cHash,no_cache
addQueryString.method = GET useCacheHash = 1
no_cache = 0
}
}
}
ACT < .NO
ACT.linkWrap = <li class="active">|</li>
USERDEF1 < .NO
USERDEF1 {
linkWrap = <li class="text-muted">|</li>
stdWrap.typolink >
}
}
}
}
This is the submenu where when you click and no translation is available it should redirect the user to the default language (L=0)
lib.subnav = HMENU
lib.subnav.entryLevel = 1
lib.subnav {
1 = TMENU
1 {
wrap = <ul class="side-nav">|</ul>
noBlur = 1
NO = 1
NO {
wrapItemAndSub = <li>|</li>
ATagTitle.field = title
typolink {
parameter.data = page:uid
additionalParams = &L=0 || &L=1
ATagParams = hreflang="de-DE" || hreflang="de-LS"
addQueryString = 1 addQueryString.exclude = L,id,cHash,no_cache
addQueryString.method = GET
useCacheHash = 1
no_cache = 0
}
}
ACT < .NO ACT {
ATagParams = class="active" wrapItemAndSub = <li class="active">|</li>
}
}
At this point i have nothing else to add. If you need more from me, feel free to ask.
Thanks in advance,
Aris
did you try this, just let typo3 take care of the link:
lib.subnav = COA
lib.subnav {
10 = HMENU
10 {
entryLevel = 1
1 = TMENU
1 {
expAll = 1
wrap = <ul class="side-nav">|</ul>
noBlur = 1
NO = 1
NO {
wrapItemAndSub = <li>|</li>
ATagParams = title="{field:title}"
ATagParams.insertData = 1
}
ACT < .NO
ACT {
wrapItemAndSub = <li class="active">|</li>
ATagParams = class="active"
}
}
}
}
My problem is, that for some reason my 2nd level menu doesn't show up at all. I checked everything I'm familiar with, but i can't figure it out.
So, here is my typoscript:
lib.navigation_level1 = COA
lib.navigation_level1 {
10 = HMENU
10 {
expAll = 1
special.value = 1
# first level
1 = TMENU
1 {
wrap = <nav class="w-nav-menu menuebar" role="navigation">|</nav>
NO = 1
NO {
stdWrap.htmlSpecialChars = 1
ATagParams = class="w-nav-link menue" style="max-width: 940px"
}
IFSUB = < .NO
IFSUB {
allWrap = <div class="w-dropdown" style="max-width:940px"><div class="w-dropdown-toggle menue">|</div></div>
stdWrap.htmlSpecialChars = 1
ATagParams = style="max-width: 940px;"
doNotLinkIt = 1
}
}
2 < .1
2.wrap = <nav class="w-dropdown-list dropdownliste">|</nav>
}
}
The items, which have further sites, are surrounded by the correct class. So this IFSUB seems to be correct.
Any ideas?
Thanks
Well, seems like i havn't tried everything.
I had to put the "expAll" on the TMENU and not on the HMENU
I need to make a menu without any links but with the url in an attribute.
The url should be in data-href="|" but now only the title will be printed in the attribute.
Is there a way to only return the url and not the link. ie. http://example.com instead of Example
Or does anyone know a different solution?
lib.mainMenu = HMENU
lib.mainMenu {
entryLevel = 1
wrap = <ul id="dropDownMenu">|</ul>
1 = TMENU
1 {
noBlur = 1
expAll = 1
NO = 1
NO {
wrapItemAndSub = <li class="nochildren">|</li>
stdWrap2.wrap = <span>|</span>
}
ACT < .NO
ACT.wrapItemAndSub = <li class="active nochildren">|</li>
# if has children
IFSUB < .NO
IFSUB.wrapItemAndSub = <li class="haschildren">|</li>
IFSUB.allWrap = |
# if has children and is active
ACTIFSUB < .IFSUB
ACTIFSUB.wrapItemAndSub = <li class="active haschildren">|</li>
ACTIFSUB.allWrap = |
}
2 < .1
2 {
wrap = <ul id="subMenu">|</ul>
NO.ATagParams = rel="nofollow"
NO.stdWrap2.insertData = 1
NO.stdWrap2.wrap = <span data-href="|" class="link">{field:title}</span>
NO.doNotLinkIt = 1
IFSUB < .NO
ACTIFSUB < .IFSUB
}
3 < .2
}
Try this (untested code):
lib.mainMenu = HMENU
lib.mainMenu {
entryLevel = 1
wrap = <ul id="dropDownMenu">|</ul>
1 = TMENU
1 {
noBlur = 1
expAll = 1
NO = 1
NO {
wrapItemAndSub = <li class="nochildren">|</li>
stdWrap2.wrap = <span>|</span>
}
ACT < .NO
ACT.wrapItemAndSub = <li class="active nochildren">|</li>
# if has children
IFSUB < .NO
IFSUB.wrapItemAndSub = <li class="haschildren">|</li>
IFSUB.allWrap = |
# if has children and is active
ACTIFSUB < .IFSUB
ACTIFSUB.wrapItemAndSub = <li class="active haschildren">|</li>
ACTIFSUB.allWrap = |
}
2 < .1
2 {
wrap = <ul id="subMenu">|</ul>
NO {
doNotShowLink = 1
stdWrap2 {
wrap >
cObject = TEXT
cObject {
typolink {
parameter.field = uid
returnLast = url
}
insertData = 1
wrap = <span data-href="|" class="link">{field:nav_title//field:title}</span>
}
}
}
IFSUB < .NO
ACTIFSUB < .IFSUB
}
3 < .2
}
The above answer only works as long as you don't have any mountpoints. As soon as you have mountpoints in your page tree, these links will not be generated correctly.
To force a HMENU to output plain URLs without a surrounding a-Tag and page title even when using mountpoints, you need to define the IProcFunc property of HMENU.
I've written a small method which can be called through IProcFunc which will remove the a-Tags and replace the page title with the URL of the link.
<?php
class UserFuncUtils {
/**
* Modifies sitemap links. Whith this modification, a menu will only generate a plain url instead of an <a>-Tag
*
* This is an IProcFunc for a HMENU. The only parameter supplied by this method call is $this->I from the
* Menu ContentObject. The function call expects a modified $I array to be returned.
*/
function IProcFunc_plainURL($I) {
// Show what $I has to offer
// print \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($I, NULL, 8, FALSE, FALSE, FALSE, array(), array());
// Remove opening and closing tags and replace title with href attribute. This results in a plain URL being rendered by the menu
$I['parts']['ATag_begin'] = '';
$I['parts']['ATag_end'] = '';
$I['parts']['title'] = $I['linkHREF']['HREF'];
return $I;
}
}
?>
Just save this small class somewhere (e.g. /fileadmin/libs/class.userFuncUtils.php) and include it with
includeLibs.userFuncUtils = fileadmin/libs/class.userFuncUtils.php
and then set the IProcFunc property of HMENU to point to this user function
lib.mainMenu = HMENU
lib.mainMenu.IProcFunc = UserFuncUtils->IProcFunc_plainURL
This should do the trick.
Using kickstart i created one extension for listing category and product.And i need to display the both category title/name & product title/name in my breadcrumb .At present i coded for calling from the database(" 40 = RECORDS") it is only showing the
RESULT :- HOME > Page Name »
My Url:-http://www.domain.com/page_name/
lib.breadcrumb=COA
lib.breadcrumb {
40 = RECORDS
40 {
dontCheckPid = 1
tables = TABLE_NAME
source.data = GPvar:tx_pi1_NAME|EXTKEY
conf.EXTKEY = TEXT
conf.EXTKEY.field = FIELD_NAME
wrap = » |
}
10 = HMENU
10 {
special = rootline
# "not in menu pages" should show up in the breadcrumbs menu
includeNotInMenu = 1
1 = TMENU
# no unneccessary scripting.
1.noBlur = 1
# Current item should be unlinked
1.CUR = 1
1.target = _self
1.wrap = <div class="breadcrumb-class"> | </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
}
}
}
Here is an example from the news extension. You can use the same approach for your extension.
http://forge.typo3.org/projects/extension-news/wiki/Add_news_to_breadcrumb_menu
We can add field title to breadcrumb from the database of any extention that which we create in typo3.
lib.breadcrumb = COA
lib.breadcrumb {
stdWrap.wrap = <ul class="breadcrumb">|</ul>
entryLevel = 1
10 = HMENU
10 {
special = rootline
1 = TMENU
1 {
noBlur = 1
NO = 1
NO {
wrapItemAndSub = <li>|</li>
ATagTitle.field = subtitle // title
linkWrap = ||*| ›  |*|
stdWrap.htmlSpecialChars = 1
}
CUR <.NO
CUR {
wrapItemAndSub = <li class="active">|</li>
}
}
}
101=RECORD
101 {
tables = tx_table_name
source.data = GPvar:tx_plugin_name|param //param passing in the url
conf.tx_besiproduct_product = TEXT
conf.tx_besiproduct_product.field = field_name
conf.tx_besiproduct_product.required = 1
conf.tx_besiproduct_product.wrap = <li >|</li>
}
}