简体   繁体   English

如何在TYPO3中获取当前页面的ID

[英]How to get ID of current page in TYPO3

我正在使用TYPO3 v8,如何获取我在后端编辑的当前页面的ID?

You can get current PageId like this. 你可以像这样得到当前的PageId

in Controller file. 在Controller文件中。

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

Using Typoscript. 使用Typoscript。

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

示例:在您的控制器中:

$id = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');

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. 如果要扩展FormEngine(编辑记录),则父页面记录位于数据数组中,由一些相当早期的数据提供程序准备。
  • 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. 如果要向“info”模块添加功能,页面ID是GET参数,您应该能够在控制器中访问它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM