whenever you return a dict() from a controller, you are able to send items
to the associated view.

For example, with something like:

def hello():
   name = db(db.person.id == ...).select(first_name)
   return dict( personname=name )

you pass 'name' to the view variable 'personname' in the view hello.html.




On Mon, Jul 27, 2009 at 3:21 PM, Dan <danbr...@gmail.com> wrote:

>
> sounds like you could use the response.vars dictionary to pass the
> information you need. For instance, your controller could have this
> line:
>
> response.vars.piechartcomponentdata = [2,3,4,7,8,9]
>
> and then your view could have this:
> {{if piechartcomponentdata in response.vars:}}
>  {{... draw your component with the data ...}}
> {{pass}}
>
> On Jul 27, 1:06 pm, jcorbett <jasoncorb...@gmail.com> wrote:
> > Is it possible to pass parameters to a view, as if it were a
> > function?  Basically I want to create components in my views, reusable
> > parts, but may depend on on a variable for the data it renders.  Any
> > ideas on how to do this?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to