public function getHeaderContainer() { $sth = $this->pdo->prepare("SELECT `header` FROM `article`"); $sth->execute(); $sth = $sth->fetch(PDO::FETCH_ASSOC); return $sth; }
wynik po var_dumpie:
Cytat
array(3) { [0]=> array(2) { ["id"]=> string(1) "1" [0]=> string(1) "1" } [1]=> array(2) { ["id"]=> string(1) "2" [0]=> string(1) "2" } [2]=> array(2) { ["id"]=> string(1) "3" [0]=> string(1) "3" } } Array ( [0] => Array ( [id] => 1 [0] => 1 ) [1] => Array ( [id] => 2 [0] => 2 ) [2] => Array ( [id] => 3 [0] => 3 ) )
teraz chcę to wrzucić do szablonu smartów
plik php:
for($i=0 ; $i<$bin ; $i++){ 'headerContainer' => $newsletter->getHeaderContainer() //reszta analogicnize..... ); }
no i w smartach
$news[i].headerContainer
oczywiście wszystko jest w sekcji {section name=i loop=$news}
A wyskakuje mi błąd:
Cytat
Notice: Array to string conversion in...
rozumiem, że chodzi o konwersję, ale nie wiem jak sobie z tym poradzić...