在 tx_news 记录的详细视图中,我循环选择的类别,如果记录具有特定类别(在本例中为 uid=5),则加载具有定义的 uid 的过滤列表视图(相关记录)。如果选择了多个类别,它也可以工作,但前提是选择的其他类别具有更高的“排序”值。我错过了什么?这是我的设置:
新闻/Detail.html
...
<!-- check category -->
<f:if condition="{newsItem.categories}">
<f:for each="{newsItem.categories}" as="category">
<f:if condition="{category.uid} == 5">
<f:then>
<f:cObject typoscriptObjectPath="lib.newsslider" />
</f:then>
</f:if>
</f:for>
</f:if>
...
排版:
lib.newsslider = USER
lib.newsslider {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = News
pluginName = Pi1
vendorName = GeorgRinger
switchableControllerActions {
News {
1 = list
}
}
settings < plugin.tx_news.settings
settings {
categories = 5
categoryConjunction = and
includeSubCategories =1
limit = 30
detailPid = 97
overrideFlexformSettingsIfEmpty := addToList(detailPid)
startingpoint = 96
templateLayout = 4
hidePagination = 1
list{
paginate {
itemsPerPage = 9
insertAbove =
}
}
}
}
如果选择的其他类别具有较低的“排序”值......例如像这样:
categories => protectedTYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorageprototypeobject (2 items)
00000000443eb767000000007f371fa2 => GeorgRinger\News\Domain\Model\Categoryprototypepersistent entity (uid=19, pid=1)
sorting => protected 8 (integer)
title => protected 'Corporates' (10 chars)
uid => protected 19 (integer)
00000000443eb763000000007f371fa2 => GeorgRinger\News\Domain\Model\Categoryprototypepersistent entity (uid=5, pid=56)
sorting => protected 16 (integer)
title => protected 'Press Releases' (14 chars)
uid => protected 5 (integer)
当我想访问来自主 [17] Media & Press 列表视图的记录时,我无法访问记录详细信息页面(永远加载)......过了一会儿我收到了这个错误:
Uncaught TYPO3 Exception
An exception occurred while executing 'SELECT * FROM `sys_template` WHERE (`pid` = ?) AND ((`sys_template`.`deleted` = 0) AND (`sys_template`.`hidden` = 0) AND (`sys_template`.`starttime` <= 1509472200) AND ((`sys_template`.`endtime` = 0) OR (`sys_template`.`endtime` > 1509472200))) ORDER BY `root` DESC, `sorting` ASC LIMIT 1' with params [1]: PHP Warning: mysqli::prepare(): MySQL server has gone away in /is/htdocs/path/www/typo3_src-8.7.8/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php line 92
TYPO3 8.7.8 & tx_news 6.1.1
编辑:
...其中 pageID [97] 也是主要新闻列表视图的详细信息页面:[17] Media & Press:
[17] Media & Press
|_[97] News Articles
|_[96] News Archive
...配置为:
[17] Media & Press
- What to display: List View (without overloading Detail view)
- Starting Point: Media & Press (sys) [96]
- Category Selection: Press Releases, Weekly Update
- Category Mode: Show items with selected categories (OR)
- PageId for single news display: News Articles [97]
- PageId for list display: Media & Press [17]
[97] News Articles
- What to display: Detail View
- PageId to return to: [17] Media & Press