我负责使用Typo3的网页,我没有创建。最近(并在协助下),Typo3的版本从6.2升级到7.6。从那时起,我已经失去了将php代码直接包含在页面中,后端中的可能性(与添加文本,图像或html的方式相同)。据我所知,曾经有一个扩展做h(php_page_content)与这个最新版本不兼容。
我已经看到了一些关于如何在互联网上进行的例子(例如在https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/UserAndUserInt/Index.html),但这对我来说相当先进,而且我无法将此应用于我的问题(我的PHP技能是几乎不存在)。有人可以在这件事上提供帮助吗?
答案 0 :(得分:4)
这是简单的东西可能会帮助你, 试试这个,它为我工作
<强> Setup.ts 强>
# Add bellow typoscrip in setup.ts
lib.content = USER
lib.content {
# Define external PHP Script file path
includeLibs = fileadmin/function.php
# Call user function
userFunc = getData->GetNewsCountInCat
# Pass your argument to the php scrpt (Here function.php)
value = This is the value
}
<强> function.php 强>
你的php逻辑在这里(路径:fileadmin /)。
class getData
{
// Initialise cObject
public $cObj;
public function GetNewsCountInCat($content, $conf=array()) {
// Get argument
$arg = $this->cObj->TEXT($conf);
echo $arg;
}
}
现在您可以使用以下命令访问html中的lib对象:
<f:cObject typoscriptObjectPath="lib.content" />
您的输出将是:
This is the value.
问候!
答案 1 :(得分:0)