How to get ID of current page in TYPO3

13,480

Solution 1

You can get current PageId like this.

in Controller file.

$currentPid = $GLOBALS['TSFE']->id

Using Typoscript.

temp.page_uid = TEXT
temp.page_uid.field = uid

Solution 2

This depends on context, examples:

  • If you are extending FormEngine (editing records), the parent page record is in the data array, prepared by some rather early data provider.
  • If you are adding a feature to the 'info' module, the page id is a GET parameter, you should be able to access this in your controller.
Share:
13,480
b.imen
Author by

b.imen

Updated on July 29, 2022

Comments

  • b.imen
    b.imen almost 2 years

    I'm using TYPO3 v8, how can I get the id of the current page that I'm editing in the backend?

  • Dhia Eddine Farah
    Dhia Eddine Farah over 6 years
    I tried this "$currentPid = $GLOBALS['TSFE']->id" and it didn't work ! I like to get the id of the current page in backoffice inside an extension that I have created and I don't have any controllers
  • Sybille Peters
    Sybille Peters over 2 years
    The question specifically asked "in the backend". $GLOBALS['TSFE'] is instantiated in the frondend.