Search code examples
typo3fluidextbasetx-news

tx_news with pw_comment plugin typo3


I need to build a news detail page with comment option. When go to the detail page there must be an option for comment. So I configure pw_comment plugin. It's working fine. But all comments shows with every news. How can I show only comments with associated news? Please help me

My typoscript settings is

plugin.tx_pwcomments {
    settings {
        useEntryUid = 1
        entryUid = TEXT
        moderateNewComments = 0
        secondsBetweenTwoComments = 60
        entryUid.data = GP:tx_news|uid
        replaceUsernameWith = COA_INT
        replaceUsernameWith {
            10 = TEXT
            10.data = LLL:EXT:pw_comments/Resources/Private/Language/locallang.xml:tx_pwcomments.newComment.loggedInAs

            20 = TEXT
            20.data = TSFE:fe_user|user|username
            20.noTrimWrap = | <b>|</b>|

            stdWrap.wrap = <div class="loggedInAs">|</div>
        }

        replaceMailWith = TEXT
        replaceMailWith.stdWrap.char = 0
    }
}
config.contentObjectExceptionHandler = 0

My template includes the following coe

<f:if condition="{settings.templateLayout} == 'NewsCommentLayout' ">
        <f:then>
                <f:cObject typoscriptObjectPath="lib.pwCommentsIndex" />
                <f:cObject typoscriptObjectPath="lib.pwCommentsNew"/>
        </f:then>

</f:if>

Solution

  • I got the solution for my problem.I edited the typoscript.

    plugin.tx_pwcomments {
        settings {
            moderateNewComments = 0
            secondsBetweenTwoComments = 60
            enableCommentVotes = 0
            enableVoting = 0
            hideVoteButtons = 1
            replaceUsernameWith = COA_INT
            replaceUsernameWith {
                10 = TEXT
                10.data = LLL:EXT:pw_comments/Resources/Private/Language/locallang.xml:tx_pwcomments.newComment.loggedInAs
    
                20 = TEXT
                20.data = TSFE:fe_user|user|username
                20.noTrimWrap = | <b>|</b>|
    
                stdWrap.wrap = <div class="loggedInAs">|</div>
            }
    
            replaceMailWith = TEXT
            replaceMailWith.stdWrap.char = 0
        }
    }
    config.contentObjectExceptionHandler = 0
    
    [globalVar = GP:tx_news_pi1|news > 0]
    plugin.tx_pwcomments.settings {
      useEntryUid = 1
      entryUid = TEXT
      entryUid.data = GP:tx_news_pi1|news
    }
    [global]