Autor Zpráva
unlucky
Profil
mam ve smary

{foreach key=kid item=itm from=$content}
//obsah
{/foreach}

Nyni do obsahu chci vlozit data:

  public function avgRating($id){
    $this->uniqueName = $id;
    $this->database();
    $this->data();
    $averageRating = round($this->decAVG * $this->elements, 1);    
    return $averageRating;
  } 
jak mam ve smarty predat id teto funkci a pak to zobrazit?
whoami
Profil
Přesně nechápu jaké id.. Ale když dáš..:
$smarty->assign('class', new class_with_function_avgRating());
tak ve Smartech můžeš volat..:
{foreach $content as $item}
  {$item.name|escape} ({$class->avgRating($item.id)|escape})
{/foreach}
unlucky
Profil
dekuju, funguje perfektne

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0