RE: [SMARTY] Pass parameter with include_php
| From: | Gary Loescher | Date: | Wed, 02 Oct 2002 13:44:30 +0000 |
| Subject: | RE: [SMARTY] Pass parameter with include_php | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6082@lists.php.net to get a copy of this message | ||
One way is to get the template variable from the Smarty object.
Add this function to your Smarty subclass:
function &GetTplVar($name)
{
return isset($this->_tpl_vars[$name]) ? $this->_tpl_vars[$name] :
NULL;
}
then do
... where field_X = $this->GetTplVar('my_parameter');
Gary
>-----Original Message-----
>From: Simone [mailto:just4smarty@email.it]
>Sent: Wednesday, October 02, 2002 4:48 AM
>To: smarty-general@lists.php.net
>Cc: John Wards
>Subject: [SMARTY] Pass parameter with include_php
>
>
>I have to read from a php file (my_file.php) a parameters
>passed from a .tpl
>file and I require the file from the .tpl file with the string
>
>{include_php file=my_file.php}
>
>Suppose that in my php file I have to query the DB with a select like :
>
>Select *
>from Tab_A
>where field_X = my_parameter
>
>and suppose that I have to get the my_parameter value from the
>template.
>
>How can I do that ?
>
>Simone
>
>--
>Smarty General Mailing List (http://smarty.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>