【问题标题】:PHP 1 is displayed instead of an image显示 PHP 1 而不是图像
【发布时间】: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

标签: php typo3


【解决方案1】:

['data']['media'] 是 FAL 使用的字段。该字段本身只包含引用的数量。

你需要用 FAL API 解析这些引用,你可以看看here

【讨论】:

    猜你喜欢
    • 2012-04-28
    • 1970-01-01
    • 2013-01-16
    • 2012-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-18
    相关资源
    最近更新 更多