我目前正在使用TYPO3扩展新闻+ pw_comments。到目前为止效果很好但<f:cObject typoscriptObjectPath="lib.pwCommentsGetCountWithLabel" />
始终显示0 Comments
而不是例如1 Comment
plugin.tx_pwcomments {
settings {
storagePid = 111
useEntryUid = 1
entryUid = TEXT
entryUidData = GP:tx_news_pi1 | news
moderateNewComments = 0
secondsBetweenTwoComments = 60
sendMailOnNewCommentsTo = asfga@hotmail.de
sendMailTemplate = fileadmin/private/ext/pw_comments/Templates/MailNotification/mail.html
}
}
如果有新闻评论。
pw_comments配置看起来像这样
useEntryUid = 1
我输入的内容有什么问题或者我忘记了什么吗?我对lib.test = CONTENT
lib.test {
table = tx_pwcomments_domain_model_comment
select {
selectFields = count(*)
pidInList = 111
andWhere = entry_uid = {field:uid}
andWhere.stdWrap.insertData = 1
}
renderObj = COA_INT
renderObj {
10 = TEXT
10 {
wrap = Anzahl Kommentare: |
data = field:count(*)
}
}
}
有点困惑,因为我不知道在这里写什么。在官方文档中查看,但我遇到了问题......
有人能以正确的方式暗示我吗?
Snippet而不是cObject:
const nodes = Array.from(document.body.querySelectorAll("div"));
//The most straight-forward way to find the parents,
//filter out any nodes where no other node in the array contains it
//(note the m !== n check, which prevents contains to return true for the same node):
let parents = nodes.filter( n => !nodes.find( m => m !== n && m.contains(n) ));
//Conversely, to find any child-nodes, invert the contains-check to find any nodes that does not contain any other node in the array:
let children = nodes.filter( n => !nodes.find( m => m !== n && n.contains(m) ));
console.log("approach 1:\n", parents, "\n", children);
//Here is the same approach using compareDocumentPosition instead of contains:
parents = nodes.filter( n => !nodes.find(m => m.compareDocumentPosition(n) & Node.DOCUMENT_POSITION_CONTAINED_BY) );
children = nodes.filter( n => !nodes.find(m => n.compareDocumentPosition(m) & Node.DOCUMENT_POSITION_CONTAINED_BY) )
console.log("approach 2:\n", parents, "\n", children);
//And finally, if you don't need the restriction of checking against
//elements in the array, you can just see if the nodes have
//the topmost parent/any children at all:
const topElement = document.body;
parents = nodes.filter( n => n.parentElement === topElement );
children = nodes.filter( n => !n.childElementCount );
console.log("approach 3:\n", parents, "\n", children);
答案 0 :(得分:0)
有一行看起来很可疑:
entryUidData = GP:tx_news_pi1 | news
我希望正常:
entryUid.data = GP:tx_news_pi1 | news
错误值的另一个原因可能是缓存。也许您需要构建一个未缓存的TS-VH(使lib.pwCommentsGetCountWithLabel
成为userInt
)。
我认为您需要旧维基中给出的配置(因为该页面未包含在当前手册中):https://forge.typo3.org/projects/extension-pw_comments/wiki/Documentation#How-to-use-pw_comments-with-other-extensions
您的配置错过了TS条件,因此只有在只选择一个tx-news记录时才会使用它:
[globalVar = GP:tx_news_pi1|news > 0 ]
## this config is only valid if one tx-news record is selected
plugin.tx_pwcomments {
settings {
:
}
}
[global]
如果您使用typoscript viewhelper(已添加),请确保为变量{field:uid}
提供值:
<f:cObject typoscriptObjectPath="lib.test">{uid:item.uid}</f:cObject>