TypoScript: get page title by page id

Viewed 18122

Task1. In TypoScript I need to get a page title for a given page id {$my_page_uid} Task2. This page title should be recieved according to the current language

I need this title in the form like temp.pTitle, so I can make then page.10 < temp.pTitle

6 Answers

I made such a script and work without VHS functions: v.page.info (on TYPO3 v9):

Examples:

<f:cObject typoscriptObjectPath="lib.pageInfo" data="{pageUid: '48', pageField: 'subtitle'}" />

lib.pageInfo = COA  
lib.pageInfo {
    5 = LOAD_REGISTER
    5 {
        ## Set the content's field (default: title):
        pageField.cObject = TEXT
        pageField.cObject {
            field = pageField
            ifEmpty.data = title
        }

        ## Allows to override the current page ID:
        pageUid.cObject = TEXT
        pageUid.cObject {
            field = pageUid
            ifEmpty.data = TSFE:id
        }
    }

    20 = RECORDS
    20 {
        source.data = register:pageUid
        tables = pages
        dontCheckPid = 1
        conf.pages = TEXT
        conf.pages.field.data = register:pageField
    }

    90 = RESTORE_REGISTER }

May this will help you

In your fluid template

<f:cObject typoscriptObjectPath="lib.pagetitle" data='your page id'/>

In Typoscript

lib.pagetitle = HMENU
lib.pagetitle {
special = list
special.value.current = 1
    1 = TMENU
    1 {
    NO {
        doNotLinkIt = 1
    }
}
}

Let me know it this not working I have other ways!!

Related