首先,当谈到 Typoscript 时,我完全是新手,只是应该对页面进行一些 css 调整。但是,我想做一个小的调整。取而代之的是(在此上下文中使用了提到的 ATagBeforeWrap):
<menulvl1>
<li>
<a>Menu-Lvl 1 Link</a>
<submenu>
<!--.... -->
</submenu>
</li>
</menulvl1>
如果没有 ATagBeforeWrap(或设置为 0),我会读到:
<li>
<a>
<submenu>
<!--.... -->
</submenu>
</a>
</li>
但我想要的是这样的:
<li>
<submenu></submenu>
<a>Menu-Lvl 1Link</a>
</li>
编辑: 这是负责渲染的打字稿。对不起大量的代码:
# Copy basic menu object from TS template 'menu' so we don't have to repeat all that
#lib.menu.level2.wrap = TEXT
menu.top < menu.defaults
menu.top {
# Also show pages which have not-in-menu flag set in page properties
includeNotInMenu = 0
# Create a menu out of the pages specifically listed under special.value
special = directory
special.value = {$menu.top.pages}
entryLevel = 0
1 {
expAll = 1
wrap = <ul class="layer1">|</ul>
NO {
doNotShowLink = 0
wrapItemAndSub = <li class="first">|</li>|*|<li>|</li>|*|<li class="last">|</li>
ATagParams = class="layer1"
}
ACT{
wrapItemAndSub = <li class="first selected">|</li>|*|<li class="selected">|</li>|*|<li class="last selected">|</li>
ATagParams = class="layer1 active"
}
IFSUB < .NO
IFSUB.ATagParams = class="layer1"
CUR < .ACT
CUR.ATagParams = class="layer1 selected"
CURIFSUB < .ACT
CURIFSUB.ATagParams = class="layer1 selected"
}
2 < .1
2.wrap(
<div class="layer2" style="display:none;">
<div class="inner-wrapper">
)
#2.wrap.insertData = 1
2.NO.doNotLinkIt = 1
2.ACT.doNotLinkIt = 1
2.IFSUB.doNotLinkIt = 1
2.CUR.doNotLinkIt = 1
2.CURIFSUB.doNotLinkIt = 1
2.NO.wrapItemAndSub = <div class="layer2-col first">|</div>|*|<div class="layer2-col">|</div>|*|<div class="layer2-col last">|</div>
2.NO.ATagParams = class="layer2"
2.ACT.wrapItemAndSub = <div class="layer2-col first">|</div>|*|<div class="layer2-col">|</div>|*|<div class="layer2-col last">|</div>
2.ACT.ATagParams = class="layer2 selected"
2.IFSUB.wrapItemAndSub = <div class="layer2-col first">|</div>|*|<div class="layer2-col">|</div>|*|<div class="layer2-col last">|</div>
2.IFSUB.ATagParams = class="layer2"
2.CUR.wrapItemAndSub = <div class="layer2-col first">|</div>|*|<div class="layer2-col">|</div>|*|<div class="layer2-col last">|</div>
2.CUR.ATagParams = class="layer2 selected"
2.CURIFSUB.wrapItemAndSub = <div class="layer2-col first">|</div>|*|<div class="layer2-col">|</div>|*|<div class="layer2-col last">|</div>
2.CURIFSUB.ATagParams = class="layer2 selected"
2.NO.linkWrap = <span class="layer2-headline">|</span>
3 < .1
#3.NO.doNotLinkIt = 0
3.wrap = <ul class="layer2-wrap">|</ul>
3.NO.wrapItemAndSub = <li>|</li>
3.NO.ATagParams =
3.ACT.ATagParams = class="active"
3.IFSUB.ATagParams =
3.CUR.ATagParams = class="selected"
3.CURIFSUB.ATagParams = class="selected"
stdWrap.prepend.data = LLL:{$filepaths.l10n}:nav_top
}
和默认值:
menu.defaults = HMENU
menu.defaults {
1 = TMENU
1 {
wrap = <ul>|</ul>
# Always unfold all sub-levels of the menu
expAll = 0
# Remove the (old) default behaviour which adds onfocus="blurLink(this);" to all links
noBlur = 1
# Define the normal state (not active, not selected) of menu items
# Using NO=1 to activate normal state is not necessary, but useful when copying
NO = 1
NO {
# Use the page title field the title property on the A-tag, but only if the navigation title is set
ATagTitle {
field = title
fieldRequired = nav_title
}
# Use the option-split feature to generate a different wrap for the last item on a level of the menu
# The last item on each level gets class="last" added for CSS styling purposes.
#
# See the TSref documentation for details about option split and other features:
# http://typo3.org/documentation/document-library/references/doc_core_tsref/current/
#wrapItemAndSub = <li class="first">|</li> |*| <li>|</li> |*| <li class="last">|</li>
wrapItemAndSub = <li>|</li>
# HTML-encode special characters according to the PHP-function htmlSpecialChars
stdWrap.htmlSpecialChars = 1
}
IFSUB = 1
IFSUB < .NO
IFSUB {
wrapItemAndSub = <li class="subpages">|</li>
ATagBeforeWrap = 1
}
# Copy properties of normal to active state, and then add a CSS class for styling
ACT = 1
ACT < .NO
ACT {
ATagParams = class="active"
}
# Copy properties of normal to current state, and then add a CSS class for styling
CUR = 1
CUR < .NO
CUR {
ATagParams = class="selected"
#wrapItemAndSub = <li class="selected">|</li>
}
CURIFSUB < .IFSUB
CURIFSUB {
ATagParams = class="selected"
}
}
2 < .1
3 < .2
stdWrap.prepend =< lib.srHint
}
这有可能吗?