2017-08-18 150 views
-1
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我得到的路径是这样的:PHP 1显示,而不是图像

<img src="uploads/media/1" alt="" title="" width="100%"> 

这不是我写的所以这就是为什么它是理解为什么它的行为方式,确实。欣赏任何提示。

+0

'的print_r($ background_image)' –

+0

入门1印刷这使我想到的问题是: $ background_image = $此 - > cObj-> parentRecord [ '数据'] [ '媒体']; –

+0

哪个TYPO3版本? –

回答

1

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

您需要解决与FAL API这些参考,你可以看看here