tx_news Display related news by tags in detail view with UserFunc

58 views Asked by At

I am trying to display related news by tags on my detail page with this UserFunc from the docs:

lib.tx_news.relatedByTags = USER
lib.tx_news.relatedByTags {
    userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
    extensionName = News
    pluginName = Pi1
    vendorName = GeorgRinger

    settings < plugin.tx_news.settings
    settings {
        excludeAlreadyDisplayedNews = 1
        limit = 1
        detailPid = 44
        useStdWrap := addToList(tags)
        tags.current = 1
        categoryConjunction = or
        overrideFlexformSettingsIfEmpty := addToList(detailPid)
        #startingpoint = 25
    }
}

inside the detail template i call my custom viewhelper which returns a uid list before the actual lib is getting called:

<f:if condition="{newsItem.tags}">
  <f:cObject typoscriptObjectPath="lib.tx_news.relatedByTags">{webart:implode(items: newsItem.tags, key: 'uid')}</f:cObject>
</f:if>

the list and detail page are on the same page which i handled via typoscript lib.dynamicContent:


lib.dynamicContent = COA
lib.dynamicContent {
    5 = LOAD_REGISTER
    5 {
        colPos.cObject = TEXT
        colPos.cObject {
            field = colPos
            ifEmpty.cObject = TEXT
            ifEmpty.cObject {
                value.current = 1
                ifEmpty = 0
            }
        }

        pageUid.cObject = TEXT
        pageUid.cObject {
            field = pageUid
            ifEmpty.data = TSFE:id
        }

        contentFromPid.cObject = TEXT
        contentFromPid.cObject {
            data = DB:pages:{register:pageUid}:content_from_pid
            data.insertData = 1
        }

        wrap.cObject = TEXT
        wrap.cObject {
            field = wrap
        }
    }

    20 = CONTENT
    20 {
        table = tt_content
        select {
            includeRecordsWithoutDefaultTranslation = 1
            orderBy = sorting
            where = {#colPos}={register:colPos}
            where.insertData = 1
            pidInList.data = register:pageUid
            pidInList.override.data = register:contentFromPid
        }

        stdWrap {
            dataWrap = {register:wrap}
            required = 1
        }
    }

    90 = RESTORE_REGISTER
}

# Override content rendering if the news record is requested
[traverse(request.getQueryParams(), 'tx_news_pi1/news') > 0]

    # typically having something like: page.10 = FLUIDTEMPLATE
    # optional to use a custom page template
    #page.10.templateName = NewsDetail

    lib.dynamicContent >
    lib.dynamicContent = USER
    lib.dynamicContent {
        userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
        extensionName = News
        pluginName = NewsDetail
        vendorName = GeorgRinger

        settings < plugin.tx_news.settings
    }
[end]

somehow the execution leads to a timeout. i tried solutions from other threads but none of them worked so far.

i use TYPO3 V12.4

maybe someone can help me with this issue or provide a better solution

0

There are 0 answers