Re: [SMARTY] Global variables.

From: Date: Tue, 11 Mar 2003 01:19:42 +0000
Subject: Re: [SMARTY] Global variables.
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8543@lists.php.net to get a copy of this message
On Tue, Mar 11, 2003 at 02:17:34AM +0200, Argiris wrote: > Hi people. > > I'm trying to use Manuel Lemos' Form Generator > class with Smarty and I'm getting a fatal error: > > Fatal error: Call to a member function on a non-object > in F:\Development\TEI\smarty\templates_c\%%-81\ > %%-810598535\header.tpl.html.php on line 13 > > As for that line it's: > $form->AddDataPart(ob_get_contents()); i don't know the Form Generator, but if you want to access global variables inside {php} or {include_php} you can make them global with global $form; the context of your php-code in {php} or {include_php} is inside a method of the Smarty-object you called fetch() or display() of. this means, you can access $this, which point's to your Smarty-object. but since you are inside a function you don't see any globals by default. HTH messju > >From what I understand the $form variable isn't global > and that causes a problem. > > So my question is: how can I make variables accessible > from all templates? > > Thank you in advance. > > Argiris > > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- höflich: Erklärung auf einem Niveau, das nicht vorsätzlich das Gegenüber als Volltrottel hinstellt. Lars Marowsky-Brée

« previous php.smarty.general (#8543) next »