[web2py] Re: get a controller function in default view
Thank you for the reply. This goes a bit above my (web2)py skills for the moment. I resolved it by declaring the entire function inside the view. that way it's always available when I call the html. On Monday, December 9, 2013 2:39:16 AM UTC+1, Anthony wrote: It would help if you show layout_1.html and how it is included in the view, but you can refer to a variable returned by the controller in any included view: In myfunction.html: {{extend 'layout.html'}} {{include 'layout_1.html'}} Then in layout_1.html: {{=myresult}} Or if you need to check whether myresult exists: {{=globals().get('myresult', '')}} Anthony On Sunday, December 8, 2013 11:41:01 AM UTC-5, Ivo wrote: I'm not quite sure what you mean or how I should do that. The layout_1.html serves as the template on how items are displayed. (it's not a replacement for layout.html) Layout_1.html is included in several other views as the basis of how to display the items. It has a table inside which dictates how the items are shown. I need to add the my_result inside that table. I'm going to try to copy the function to a model as well. that should make it globally available. Since I'm new to all of this I'm not sure on how things should be done and what's best practice. On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote: why not extend the layout_1.html in your view? e.g. {{extend 'layout_1.html'}} best regards, stifan -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: get a controller function in default view
Doesn't sound like a good idea. We can help more if you show some code. On Monday, December 9, 2013 5:48:41 AM UTC-5, Ivo wrote: Thank you for the reply. This goes a bit above my (web2)py skills for the moment. I resolved it by declaring the entire function inside the view. that way it's always available when I call the html. On Monday, December 9, 2013 2:39:16 AM UTC+1, Anthony wrote: It would help if you show layout_1.html and how it is included in the view, but you can refer to a variable returned by the controller in any included view: In myfunction.html: {{extend 'layout.html'}} {{include 'layout_1.html'}} Then in layout_1.html: {{=myresult}} Or if you need to check whether myresult exists: {{=globals().get('myresult', '')}} Anthony On Sunday, December 8, 2013 11:41:01 AM UTC-5, Ivo wrote: I'm not quite sure what you mean or how I should do that. The layout_1.html serves as the template on how items are displayed. (it's not a replacement for layout.html) Layout_1.html is included in several other views as the basis of how to display the items. It has a table inside which dictates how the items are shown. I need to add the my_result inside that table. I'm going to try to copy the function to a model as well. that should make it globally available. Since I'm new to all of this I'm not sure on how things should be done and what's best practice. On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote: why not extend the layout_1.html in your view? e.g. {{extend 'layout_1.html'}} best regards, stifan -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: get a controller function in default view
why not extend the layout_1.html in your view? e.g. {{extend 'layout_1.html'}} best regards, stifan -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: get a controller function in default view
I'm not quite sure what you mean or how I should do that. The layout_1.html serves as the template on how items are displayed. (it's not a replacement for layout.html) Layout_1.html is included in several other views as the basis of how to display the items. It has a table inside which dictates how the items are shown. I need to add the my_result inside that table. I'm going to try to copy the function to a model as well. that should make it globally available. Since I'm new to all of this I'm not sure on how things should be done and what's best practice. On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote: why not extend the layout_1.html in your view? e.g. {{extend 'layout_1.html'}} best regards, stifan -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: get a controller function in default view
Any one know how I can do this. I tried creating a model but still no joy... On Sunday, December 8, 2013 5:41:01 PM UTC+1, Ivo wrote: I'm not quite sure what you mean or how I should do that. The layout_1.html serves as the template on how items are displayed. (it's not a replacement for layout.html) Layout_1.html is included in several other views as the basis of how to display the items. It has a table inside which dictates how the items are shown. I need to add the my_result inside that table. I'm going to try to copy the function to a model as well. that should make it globally available. Since I'm new to all of this I'm not sure on how things should be done and what's best practice. On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote: why not extend the layout_1.html in your view? e.g. {{extend 'layout_1.html'}} best regards, stifan -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: get a controller function in default view
{{extend 'layout1.html}} {{=my_result}} Ovidio Marinho Falcao Neto ITJP.NET.BR ovidio...@gmail.com Brasil 2013/12/8 Ivo ivo.nijenh...@gmail.com Any one know how I can do this. I tried creating a model but still no joy... On Sunday, December 8, 2013 5:41:01 PM UTC+1, Ivo wrote: I'm not quite sure what you mean or how I should do that. The layout_1.html serves as the template on how items are displayed. (it's not a replacement for layout.html) Layout_1.html is included in several other views as the basis of how to display the items. It has a table inside which dictates how the items are shown. I need to add the my_result inside that table. I'm going to try to copy the function to a model as well. that should make it globally available. Since I'm new to all of this I'm not sure on how things should be done and what's best practice. On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote: why not extend the layout_1.html in your view? e.g. {{extend 'layout_1.html'}} best regards, stifan -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: get a controller function in default view
It would help if you show layout_1.html and how it is included in the view, but you can refer to a variable returned by the controller in any included view: In myfunction.html: {{extend 'layout.html'}} {{include 'layout_1.html'}} Then in layout_1.html: {{=myresult}} Or if you need to check whether myresult exists: {{=globals().get('myresult', '')}} Anthony On Sunday, December 8, 2013 11:41:01 AM UTC-5, Ivo wrote: I'm not quite sure what you mean or how I should do that. The layout_1.html serves as the template on how items are displayed. (it's not a replacement for layout.html) Layout_1.html is included in several other views as the basis of how to display the items. It has a table inside which dictates how the items are shown. I need to add the my_result inside that table. I'm going to try to copy the function to a model as well. that should make it globally available. Since I'm new to all of this I'm not sure on how things should be done and what's best practice. On Sunday, December 8, 2013 5:14:19 PM UTC+1, 黄祥 wrote: why not extend the layout_1.html in your view? e.g. {{extend 'layout_1.html'}} best regards, stifan -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.