singleSRC im Template funktioniert nicht - keine Pfaderstellung
Hallo,
ich versuche mich anhand der Tuts von Patrick Froch. Aktuell ein Contenelement mit nur einem Bild und diversen Feldern zum Befüllen. Das Bild will sich im Frontend aber nicht zeigen » der Pfad im <src=""> wird nicht erstellt.
das HTML-Ergebnis:
PHP-Code:
<img src="" alt="" height="" width="">
::before
</img>
die teamboxClass.php
PHP-Code:
<?php
class teamboxClass extends \ContentElement
{
/**
* Template
* @var string
*/
protected $strTemplate = 'ce_beReteambox';
/**
* Compile the content element
*/
protected function compile()
{
if (TL_MODE == 'BE') {
$this->genBeOutput();
} else {
$this->genFeOutput();
}
}
/**
* Generate the content element backend
*/
private function genBeOutput()
{
$this->strTemplate = 'be_wildcard';
$this->Template = new \BackendTemplate($this->strTemplate);
$this->Template->title = $this->headline;
$this->Template->wildcard = "### beRe Teambox ###";
}
/**
* Generate the content element frontend
*/
private function genFeOutput()
{
$intId = \Contao\Input::get('id');
if ($intId) {
$objImage = $this->loadImage($intId);
$this->Template->objImage = $objImage;
$this->insertImage($objImage);
}
}
private function loadImage($intId)
{
$objDb = \Contao\Database::getInstance();
$strQuery = "SELECT * FROM tl_content WHERE id = $intId";
$objResult = $objDB->execute($strQuery);
return $objResult;
}
private function insertImage($objImage)
{
$arrData = $objImage->fetchAssoc();
$arrData['title'] = $arrData['imgtitle'];
$arrData['singleSRC'] = \Contao\FilesModel::FindByUuid($arrData['singleSRC'])->path;
$this->addImageToTemplate($this->Template, $arrData);
}
}
und im template
ce_beReteambox.html5
PHP-Code:
<div class="<?php echo $this->class; ?> block">
<div class="photoclass">
<?php $this->insert('picture_default', $this->picture); ?>
</div>
</div>
Hat jemand nen Tipp für mich, wo der Hund begraben sein könnte?
Diesen Link habe ich schon x-mal "durchforstet" ... hilft mir aber auch nicht weiter :(