Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [SMARTY][PHP]
artek
post
Post #1





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 6.10.2015

Ostrzeżenie: (0%)
-----


Hej, zaciągam z bazy danych kolumnę do tablicy

  1. public function getHeaderContainer() {
  2. $sth = $this->pdo->prepare("SELECT `header` FROM `article`");
  3. $sth->execute();
  4. $sth = $sth->fetch(PDO::FETCH_ASSOC);
  5.  
  6. return $sth;
  7. }


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:
  1. for($i=0 ; $i<$bin ; $i++){
  2. $news[$i] = array(
  3. 'headerContainer' => $newsletter->getHeaderContainer()
  4. //reszta analogicnize.....
  5. );
  6. }


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ć...
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 4.10.2025 - 16:15