Create smarty code in module

Hi there me again :confused:

Can someone please tell me how I can make smarty vars within a module.
In the .tpl its verry easy you just do [B]$this->assign() [/B]or [B][{assign}][/B]
but how does it work when I’m writing my own module.

I tried the following but none of them did the trick… I don’t understand why it has to be so complicated to create a smarty var


// method 1
$oActView = oxNew( 'oxubase' );
$oSmarty = oxUtilsView::getInstance()->getSmarty();
$oSmarty->assign('test', "test");
$oSmarty->fetch("tpl/layout/page.tpl");


// method 2
$this->_aViewData['test'] = "test"; // 1. try
$this->assign('test', "test"); // 2. try
$this->_tpl_vars['test'] = "test"; // 3. try

Any help is appreciated thanks

what class dou your module extend and how do you try to get this vars in the template?

In my module I extend 2 classes

I extend the Core file “oxbase” and the View file “start”

I am trying to create the smarty in the Core file

After years of searching and trying I finally did it… I just don’t get why it didnt work before because I tried this at the beginning -_-

anyways here is the solution


$smarty = oxUtilsView::getInstance()->getSmarty();
$smarty->assign("test", "test");

I guess oxbase may Not be extended

[QUOTE=vanilla thunder;99599]I guess oxbase may Not be extended[/QUOTE]

right