If you include both file_1 and file_2 you should have two blocks (one each)
with different names within the same script. I would also suggest that you
include the <script></script> part in the block. For example
{{block script1}}{{end}}
{{block script2}}{{end}}
then file1 would do
{{block script1}}
<script>
... do something with jquery ...
</script>
{{end}}
On Wednesday, 10 December 2014 19:38:29 UTC-6, Lisandro wrote:
>
> I'm wondering if it's possible to append content to a block from multiple
> included files
> This a resume of what I would like to do:
>
> layout.html
> <html>
> {{include}}
> <script src="//
> ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
> <script>
> {{block jquery_code}}
> {{end}}
> </script>
> </html>
>
> index.html
> {{extend 'layout.html'}}
>
> <p>This is a paragraph</p>
>
> {{include 'file_1.html'}}
> {{include 'file_2.html'}}
>
> And then the two included files looking pretty much the same for this
> example:
> <p>This is file_1.html</p>
>
> {{blockjquery_code}}
> //Some jquery code here
> {{end}}
>
> <p>This is file_2.html</p>
>
> {{blockjquery_code}}
> //Some jquery code here
> {{end}}
>
> This way it doesn't work. I also tried adding {{block jquery_code}}
> {{end}} to the index.html file. And I also tried using {{super}}, but
> nothing.
>
> I'm trying to use it this way so the jquery.min.js file is included in the
> bottom of the html (accordingly to what it is the preffered way). Then, I
> would be able to add some jquery code in every extended view, like the
> file_1.html and file_2.html examples above.
>
> I'm trying to figure out how to do it. Any suggestions about achieving the
> same with a different approach? Thanks in advance!
>
--
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.