You can put in your model:

response.anythingyoulike="something"

Then in your view

{{=response.anythingyoulike}}

On Dec 22, 1:12 pm, greenguerilla <johngerardoconn...@gmail.com>
wrote:
> Hi,
>
> I have a search form which I wish to appear on every page. I would
> rather define this programatically than with html but I wish to avoid
> having to remember to add this variable to the dictionary returned by
> every controller function.
>
> In Django one can create a context processor which returns the
> variable and use a RequestContext in every view function. Is there a
> similar mechanism for web2py? If the answer is to store it in the
> response object, is there a place where I can write this code once and
> once only and have it added automatically to the response every time?
>
> Another option I considered was to define a custom dictionary:
> my_dict = dict(search_form=search_form)
>
> Then I could update this in every controller function and return it.
> That would still require modifying all of our controller functions
> though...
>
> Any and all suggestions are welcome!
>
> Cheers,
>
> John

Reply via email to