Hi, ich habe hier ein älteres Template:
PHP-Code:
<?php
$list='';
$O='';
$msg = '';
// Listenansicht (nicht genutzt)
/*
if($GLOBALS[_GET]['details']!='1') {
$result = $this->Database->execute('SELECT distinct(NAME),DESC_TEXT, substring(NAME,5,1) as x FROM TblSiebelTrainingCourses where substring(NAME,5,1)>\'0\' order by NAME');
if($result->numRows) {
$rows = $result->fetchAllAssoc();
$count=0;
foreach ($rows as $row) {
$count++;
$list{$count}{'name'}=$row['NAME'];
$list{$count}{'descr'}=$row['DESC_TEXT'];
}
$list[0]=$count;
$O.='<br><b>Enfinity Suite 6</b><br>';
$O.='<ul>';
for($i=1;$i<=$list[0];$i++) {
$querystring = Array('details' => '1', 'course' => $list{$i}{'name'}, 'no_cache' => '1');
$O.='';
$O.='<li>'.$list{$i}{'name'}.' <a href="#">'.$list{$i}{'descr'}.'</a></li>';
}
$O.='</ul>';
$O.='<br>';
}
}
*/
// Detailansicht
if($this->Input->get('course')!='') {
$this->import('Database');
$courserelpath = $_SERVER['DOCUMENT_ROOT'];
$coursefilepath = '/files/layout/media/downloads/de/training/';
$downloadpath = 'training-kursdetails?file=files/layout/media/downloads/de/training/';
$registerpath = 'training-kursdetails?register=1&cid=';
$course = $this->Input->get('course');
$result = $this->Database->execute('SELECT Id, NAME, START_DT, END_DT, DESC_TEXT, LOCATION_DESC, STATUS_CD, DURATION_DESC, LST_PRI_CURCY_CD, LST_PRI_AMT from TblSiebelTrainingCourses where NAME=\''.$course.'\' order by START_DT, NAME');
if($result->numRows) {
$rows = $result->fetchAllAssoc();
$count=0;
foreach ($rows as $row) {
$count++;
$list{$count}{'id'}=$row['Id'];
$list{$count}{'name'}=$row['NAME'];
$list{$count}{'start'}=substr($row['START_DT'],8,2).'.'.substr($row['START_DT'],5,2).'.'.substr($row['START_DT'],0,4);
$list{$count}{'end'}=$row['END_DT'];
$list{$count}{'descr'}=$row['DESC_TEXT'];
$list{$count}{'location'}=$row['LOCATION_DESC'];
$list{$count}{'status'}=$row['STATUS_CD'];
$list{$count}{'duration'}=$row['DURATION_DESC'];
$list{$count}{'currency'}=$row['LST_PRI_CURCY_CD'];
$list{$count}{'price'}=$row['LST_PRI_AMT'];
}
$list[0]=$count;
if($list[0]){
$O.='<h1>'.$list{1}{'descr'}.' ('.$course.')</h1>';
if (file_exists($courserelpath.$coursefilepath.$course.'-DE.pdf')) {
$O.='
<div class="ce_download block">
<ul>
<li><a class="pdf" href="'.$downloadpath.$course.'-DE.pdf">Kursbeschreibung</a></li>
</ul>
</div>';
}
$O.='<h3>Trainingskalender für '.$list{1}{'descr'}.' ('.$course.')</h3>';
$O.='<div class="ce_table block"><table cellspacing="0" cellpadding="0" summary="Trainingskalender">';
$O.='<thead><tr><th class="head_0 col_first">Datum</th><th class="head_1">Dauer</th><th class="head_2">Ort</th><th class="head_3">Preis</th><th class="head_4 col_last"> </th></tr></thead><tbody>';
for($i=1;$i<=$list[0];$i++) {
if($i % 2 != 0)
$className = 'even';
else
$className = 'odd';
$querystring = Array('register' => '1', 'cid' => $list{$i}{'id'}, 'no_cache' => '1');
$O.='<tr class="'.$className.'"><td>'.$list{$i}{'start'}.'</td><td>'.$list{$i}{'duration'}.'</td><td>'.$list{$i}{'location'}.'</td><td>'.$list{$i}{'currency'}.' '.$list{$i}{'price'}.'</td><td><a href="'.$registerpath.$list{$i}{'id'}.'">Anmelden</a>';
}
$O.='</tbody></table></div>';
}
}
Und bekomme diese Fehlermeldung:
Code:
[10-Jan-2018 14:30:37 Europe/Berlin] PHP Fatal error: Uncaught exception 'Error' with message 'Cannot use string offset as an array' thrown in /wwwroot.wwwnew/templates/training-courses-de.php on line 51
#0 /wwwroot.wwwnew/system/modules/core/library/Contao/InsertTags.php(1113): include()
#1 /wwwroot.wwwnew/system/modules/core/library/Contao/Controller.php(692): Contao\InsertTags->replace('<!DOCTYPE html>...', false)
#2 /wwwroot.wwwnew/system/modules/core/classes/FrontendTemplate.php(100): Contao\Controller::replaceInsertTags('<!DOCTYPE html>...', false)
#3 /wwwroot.wwwnew/system/modules/core/pages/PageRegular.php(190): Contao\FrontendTemplate->output(true)
#4 /wwwroot.wwwnew/system/modules/core/controllers/FrontendIndex.php(285): Contao\PageRegular->generate(Object(Contao\PageModel), true)
#5 /wwwroot.wwwnew/index.php(20): Contao\FrontendIndex->run()
#6 {main}
Der Fehler bezieht sich auf:
PHP-Code:
$list{$count}{'id'}=$row['Id'];
Nur wo liegt da der Fehler?^^
LG & Danke
Lesezeichen