Kiran,

Thanks.

I came across same solution when I searched this forum a little more (I had 
already searched before posting, obviously not enough)
https://groups.google.com/d/msg/web2py/b1WmPZh6PlI/nMAX-u5Des0J

-Mandar

On Tuesday, July 1, 2014 10:49:23 PM UTC+5:30, Kiran Subbaraman wrote:
>
>  globals().get(' hide_my_div',False) should return a False, if this is 
> not present.
>
> ________________________________________
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On Tue, 01-07-2014 10:06 PM, Mandar Vaze wrote:
>  
> Hi,
>
> I have several views which are similar, so I am using common view file 
> using "response.view =common_view.html" rather than separate one per 
> controller.
>
> Out of these - 2 or 3 views are slightly different where certain parts of 
> the page (layout.html) need to be hidden.
>
> I tried :
>
> return dict(msg=msg, grid=grid, hide_my_div=True)
>
> in the view template I have :
>
> {{if hide_my_div:}}
> <script>
>  $(document).ready(function(){
>       $("#my_div").hide();
>   });
> <script>
> {{pass}}
>
> This works for the small number of views where I want to hide "my_div"
> Unfortunately - this also means I need to pass "hide_my_div=False" from 
> large number of controllers.
>
> Is there a way to have hide_my_div=False *as a default* - so that I do 
> not need to return it explicitly - and I can override only when needed (2-3 
> controllers)
> Something like optional params with default values ?
>
> May be the way I am handling this is wrong. Is there a better way ?
>
> (I know that I can create separate view files for these "odd ones", but I 
> prefer not to, since these are going to be 90% similar to common_view.html 
> anyway)
>
> Thanks,
> -Mandar
>  -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to