RE : [SMARTY] Problem with PHP functions

From: Date: Fri, 02 May 2003 08:20:08 +0000
Subject: RE : [SMARTY] Problem with PHP functions
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9444@lists.php.net to get a copy of this message
You must declare you variable as global in each file, each function. If you don't do that, php create a local variable instead. I think it would be better to return you $cart_price with a : "return $cart_price" at the end of your function ! You just have to add a "global $cart_price" in the 2nd include_php file -----Message d'origine----- De : Martin Voelkening [mailto:info@0700webhilfe.de] Envoyé : jeudi 1 mai 2003 23:56 À : Smarty Mailinglist Objet : [SMARTY] Problem with PHP functions Hi, I have the following situation: index.tpl ... {include_php file="File with PHP functions e.g. getprice"} ... {include_php file="File that calls function getprice"} ... The second include_php calls the function getprice (which is in the 1st include_php). The call works fine but I haven't figured out how to access the result variable $cart_price (declared as global in the PHP function) in the 2nd include_php file. The normal way $cart_price doesn't work... Who can help me? Thanks Martin ---------------------------------------------------------------------- 0700webhilfe.de Martin Völkening - Geschäftsführer http://www.0700webhilfe.de mailto:martin@0700webhilfe.de Max-Joseph-Str. 18 - 51429 Bergisch Gladbach Fax 0700-WEBHILFE also 0700-93244533 --------------------------------------------------------------------- -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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