Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

passing parameters with include_php

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
datamile
Smarty Rookie


Joined: 17 May 2003
Posts: 13

PostPosted: Wed Jul 09, 2003 10:23 pm    Post subject: passing parameters with include_php Reply with quote

OK,

I'm using include_php in templates to enable template block functions.

Now many of the blocks are fairly common but with slightly different options depending on where there we called.

i.e. I do estate agent sites , and depending on the calling template , they may want the sales or letting search block...

Fundentially I would like to be able to pass a simple assign variable with include_php to pass a value to the code.

i.e. include_php("search_block.php","mode=sales")
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Thu Jul 10, 2003 3:34 am    Post subject: Reply with quote

Code:
blah.tpl:
{assign var="mode" value="sales"}
{include_php file="blah.php"}

blah.php:
$mode = $this->get_template_vars("mode");
if($mode == "sales") {
    // sales
} else {
    // otherwise
}


something like that should work
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP