No, you define a function like show() in Massimo's example, and then you
just call that function:
{{=show(roots[0])}}
show() is called recursively. The default/initial value of "n" is 0 (you
don't need to specify that), and the recursive calls automatically
increment n by 1.
Anthony
On Wednesday, June 1, 2016 at 2:06:14 PM UTC-4, Alex Glaros wrote:
>
> can someone show me syntax for use outside of the "return" statement?
>
> In other words, I want to run and display data within a larger function
> than the example, that already has vars and data I need, and displays other
> data that needs to appear.
>
> My model is self-referencing table with link to parent named:
> "taxonomy_column_parent_fk
>
> In controller
>
> roots = db(db.taxonomy_column).select().as_trees(parent_name=
> "taxonomy_column_parent_fk")
>
> In view
>
> {{for c in roots:}}
> {{=' '*n+row.body+'\n'+''.join(show(c,n+1))}}
> {{pass}}
>
> Error
>
> <type 'exceptions.NameError'> name 'n' is not defined
>
> thanks
>
> Alex Glaros
>
--
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.