Re: [SMARTY] Global all variables?
| From: | messju mohr | Date: | Sun, 27 Apr 2003 20:07:01 +0000 |
| Subject: | Re: [SMARTY] Global all variables? | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9395@lists.php.net to get a copy of this message | ||
On Sun, Apr 27, 2003 at 02:56:37PM +0000, Pablo Fischer wrote:
> Hi all!
>
> Finally I finish my project, but I have a little problem: In my CMS Im
> using a poll system (sympoll), So im including it with the template
>
> {include_php="poll/booth.php"}
>
> The problem here is: Sympoll dont couldnt find the variables (database
> user, host, password, etc) inside the call of include_php. So.. exists a
> way to include a phpfile with Smarty but at the same time, globalizing
> all the variables that the .php file has?.
hmm. you can do "extract($GLOBALS);" in the beginning of your included php.
but there are two caveats, you must keep in mind:
- changing the extracted variables inside the include_php'd script ,
doesn't change the global ones.
- if you create new variables in the include_php'd script, they are
not global automatically, of course
HTH
messju
> Thanks!
> Pablo Fischer.