watsonpy / watson-framework

A Python 3 web app framework.
BSD 3-Clause "New" or "Revised" License
104 stars 12 forks source link

{{ content }} small question hot to get more veriables in viev #12

Closed krystian566 closed 9 years ago

krystian566 commented 9 years ago

controller return for me some information t. And i can open by typing {{ content }} in view. But how to create/get {{ menu }} in view.

I do not know good place to ask for that.

simoncoulton commented 9 years ago

You can return a dict from the controller

{ content: 'something', menu: ('item', 'item') }

You can reference these via {{ content }} and {{ menu }} respectively from the view. Depending on the data you return to the view, you may want to loop through it. For the above you'd do something like:

{% for item in menu %}{{ item }}{% endfor %}

Hope this clears things up for you :)

krystian566 commented 9 years ago

Hope this clears things up for you :) Yes. You speak very simple for me. // for other // we get more variables by veritable structure. We can use like dict tupe list. {'content1': 'good wish for simon', 'content2':'make your word comm true' }

by call element in structure

{{content1}}
// and get raight msg // we can write more advance data give solution of reword and common work

I need function what give me more not re write html code and good control.