Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

unutar SMARTY-a pozvat PHP class

[es] :: PHP :: Smarty template engine :: unutar SMARTY-a pozvat PHP class

[ Pregleda: 3316 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

xxxrugby

Član broj: 16068
Poruke: 653
*.adsl.net.t-com.hr.

Sajt: www.zagreb-rugby.hr


Profil

icon unutar SMARTY-a pozvat PHP class09.02.2007. u 13:58 - pre 209 meseci
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
xxxrugby: "We are all philosophers, when question is about politics!"
 
Odgovor na temu

xxxrugby

Član broj: 16068
Poruke: 653
*.adsl.net.t-com.hr.

Sajt: www.zagreb-rugby.hr


Profil

icon Re: unutar SMARTY-a pozvat PHP class09.02.2007. u 14:27 - pre 209 meseci
rjeseno

{php}
$Section = new Section();
$p = $Section -> vrati_file();
$this->assign('path',$p);
{/php}
{include file=$path}
xxxrugby: "We are all philosophers, when question is about politics!"
 
Odgovor na temu

[es] :: PHP :: Smarty template engine :: unutar SMARTY-a pozvat PHP class

[ Pregleda: 3316 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.