Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

unutar SMARTY-a pozvat PHP class

unutar SMARTY-a pozvat PHP class 09.02.2007. u 14:58 · pre 241 mesec #1
Covjece kako mi se cini da cu sve napravit u cistom php-u jel je lakse nego s smarty-em

Ok.

Kako iz smarty-a pozvat ovakau PHP klasu

Code:
<?PHP
    class Section
    {
        function vrati_header()
        {
            return "NOVOSTI";
        }
        
        function vrati_file()
        {
            return "novosti.tpl";
        }
    }
?>


te sad unutar tpl-a.

{PHP}
include ("php_classes/switch_case");
$Section = new Section()
$path = $Section -> vrati_file(); // npr. novosti.tpl
////////// i sad bi tu neku komandu kao {include file = $path}
{/PHP}

ili da se bar taj $path vidi izvan {PHP} komandi
Potpis
xxxrugby: "We are all philosophers, when question is about politics!"
Re: unutar SMARTY-a pozvat PHP class 09.02.2007. u 15:27 · pre 240 meseci #2
rjeseno

{php}
$Section = new Section();
$p = $Section -> vrati_file();
$this->assign('path',$p);
{/php}
{include file=$path}
Potpis
xxxrugby: "We are all philosophers, when question is about politics!"
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme