问题
I'm using TYPO3 v8, how can I get the id of the current page that I'm editing in the backend?
回答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
回答2:
Example: In your controller:
$id = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
回答3:
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.
来源:https://stackoverflow.com/questions/48103446/how-to-get-id-of-current-page-in-typo3