菜单:包装每个 X 项 [英] Menu: wrap every X item
问题描述
我试图将每第三个项目包装在用 TypoScript 生成的菜单中.
这是我的菜单:
tt_content.menu.20.4 >tt_content.menu.20.4 <tt_content.menu.20.1tt_content.menu.20.4.stdWrap.outerWrap = <div class="my-menu">|</div>tt_content.menu.20.4.1.wrap = <ul>|</ul>tt_content.menu.20.4.1.NO {doNotLinkIt = 1stdWrap.htmlSpecialChars = 0stdWrap.cObject = COAstdWrap.cObject {# 标题10 = 文本10 {字段 = 标题打字链接.parameter.field = uidTyplink.ATagParams = class="more"}# 抽象的20 = 文本20{字段 = 摘要htmlSpecialChars = 1包裹 = <span>|</span>}}}
通过 我如何应用不同的包装到每个菜单项?我知道如何包装不同的每个项目,有没有办法将三个项目包装在一起?并且当有超过 3 % x = 0 项时,例如14、最后一个开始标签必须用最后一个项目关闭.
当前输出:
想要的输出,像这样:
<a href="index.php?id=1">第 1 页</a><a href="index.php?id=2">第 2 页</a><a href="index.php?id=3">第3页</a><div class="pack"><a href="index.php?id=4">第4页</a><a href="index.php?id=5">第5页</a><a href="index.php?id=6">第6页</a>
<div class="pack"><a href="index.php?id=7">第7页</a><a href="index.php?id=8">第8页</a><a href="index.php?id=9">第 9 页</a>
<div class="pack"><a href="index.php?id=10">第 10 页</a><a href="index.php?id=11">第 11 页</a>
下面的排版可能对你有帮助(页面菜单将 3 个页面链接组合在一起,你需要根据你的要求修改它.):
page.234 = COA第234页{包裹 = <ul>|</ul>10 = HMENU10.1 = TMENU10.special = 目录10.special.value = 110.1 {wrap = <li><ul>|</ul></li>开始 = 1最大项目数 = 3不 {allWrap = |</li>}}20<.1020.1. 开始 = 630<.1030.1. 开始 = 9#等等等等}
I am trying to wrap every 3rd item in a menu generated with TypoScript.
This is my menu:
tt_content.menu.20.4 >
tt_content.menu.20.4 < tt_content.menu.20.1
tt_content.menu.20.4.stdWrap.outerWrap = <div class="my-menu">|</div>
tt_content.menu.20.4.1.wrap = <ul>|</ul>
tt_content.menu.20.4.1.NO {
doNotLinkIt = 1
stdWrap.htmlSpecialChars = 0
stdWrap.cObject = COA
stdWrap.cObject {
# title
10 = TEXT
10 {
field = title
typolink.parameter.field = uid
typolink.ATagParams = class="more"
}
# abstract
20 = TEXT
20 {
field = abstract
htmlSpecialChars = 1
wrap = <span>|</span>
}
}
}
Via How can I apply a different wrap to every menu item? I know how to wrap every item different, is there a way to wrap three items together? And when there are more than 3 % x = 0 items, e.g. 14, the last opening tag has to be closed with the last item.
Current output:
<ul class="csc-menu csc-menu-1">
<li>
<a href="index.php?id=1">Page 1</a>
</li>
<li>
<a href="index.php?id=2">Page 2</a>
</li>
<li>
<a href="index.php?id=3">Page 3</a>
</li>
<li>
<a href="index.php?id=4">Page 4</a>
</li>
<li>
<a href="index.php?id=5">Page 5</a>
</li>
<li>
<a href="index.php?id=6">Page 6</a>
</li>
<li>
<a href="index.php?id=7">Page 7</a>
</li>
<li>
<a href="index.php?id=8">Page 8</a>
</li>
<li>
<a href="index.php?id=9">Page 9</a>
</li>
</ul>
Wanted output, something like this:
<div class="pack">
<a href="index.php?id=1">Page 1</a>
<a href="index.php?id=2">Page 2</a>
<a href="index.php?id=3">Page 3</a>
</div>
<div class="pack">
<a href="index.php?id=4">Page 4</a>
<a href="index.php?id=5">Page 5</a>
<a href="index.php?id=6">Page 6</a>
</div>
<div class="pack">
<a href="index.php?id=7">Page 7</a>
<a href="index.php?id=8">Page 8</a>
<a href="index.php?id=9">Page 9</a>
</div>
<div class="pack">
<a href="index.php?id=10">Page 10</a>
<a href="index.php?id=11">Page 11</a>
</div>
The below typoscript may help you (It's for page menu to group 3 page links together and you need to modify it according to your requirements.):
page.234 = COA
page.234{
wrap = <ul> |</ul>
10 = HMENU
10.1 = TMENU
10.special = directory
10.special.value = 1
10.1 {
wrap = <li><ul>|</ul></li>
begin = 1
maxItems = 3
NO {
allWrap = <li> |</li>
}
}
20 < .10
20.1.begin = 6
30 < .10
30.1.begin = 9
# etc. etc.
}
这篇关于菜单:包装每个 X 项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!