【发布时间】:2017-08-18 06:48:28
【问题描述】:
public function main($content, array $conf) {
$this->conf = $conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$content = '';
$background_image = $this->cObj->parentRecord['data']['media'];
// Wenn ein Bild vorhanden ist
if ($background_image != '') {
$content .= '<img src="uploads/media/'.$background_image.'" alt="" title="" width="100%" />';
}
return $this->pi_wrapInBaseClass($content);
}
当期待 html 我得到这样的路径:
<img src="uploads/media/1" alt="" title="" width="100%">
这不是我写的,所以这就是为什么要了解它的行为方式。感谢任何提示。
【问题讨论】:
-
print_r($background_image) -
打印 1 让我觉得问题出在:$background_image = $this->cObj->parentRecord['data']['media'];
-
哪个 TYPO3 版本?
-
Und "Wenn Kein Bild vorhanden ist"? (当没有图像时?)即使你的
alt=""是空的,而if也没有else- 这真的是你想要的吗? -
这是 Typo3 7.6.21