Am working on PYTHON +BRANWAVE(framework)
Actually am Trying 2 make a tree menu using d both. Am not able 2 target the (.tmpl) files and not getting how 2 make frames in .tmpl file...
Can anyone get me a demo screen 4 d same showing a tree on the left and when we click any link in the tree, corresponding page(.tmpl) page opens up on right...
This is a simple Tree Example>>>>>>> file name="mytreeapp.py"
Expand|Select|Wrap|Line Numbers
- import iris
- import aphrodite
- from plugins.CheetahPlugin import CheetahRender
- class mytreeapp(iris.App):
- def __init__(self):
- iris.App.__init__(self)
- self.aphrodite = aphrodite.Aphrodite('mytreeapp')
- @iris.expose
- def default(self, *args, **kwargs):
- pass
- @iris.expose
- def index(self, *args, **kwargs):
- return CheetahRender(template="index")
- @iris.expose
- def tree(self):
- data = [
- {'title':'Rock Music', 'description':'Rock Albums', 'icon':'/mytreeapp/resources/avatars/a1.png', 'items':[
- {'title':'Reckless (1984)', 'description': 'Bryan Adams','items':[{'title':'Summer of 69','description':'B.Adams,J.Vallance','link':'javascript:show("Summer of 69")'},{'title':'One Night Love Affair','description':'B.Adams,J.Vallance','link':'javascript:show("One Night Love Affair")'},{'title':'Heaven','description':'B.Adams,J.Vallance','link':'javascript:show("Heaven")'}]},
- {'title':'Bon Jovi (1984)', 'description': 'Jon Bon Jovi','items':[{'title':'Runaway','description':'Jon Bon Jovi, George Karak','link':'javascript:show("Runaway")'},{'title': "She Don't Know Me",'description':'Mark Avsec','link':'javascript:show("She Don\'t Know Me")'},{'title':'Shot Through The Heart','description':'Bon Jovi, Jack Ponti','link':'javascript:show("Shot Through The Heart")'}]},
- {'title':'The Open Door (2006)', 'description': 'Evanescence','items':[{'title':'Sweet Sacrifice','description':'Amy Lee, Terry Balsamo','link':'javascript:show("Sweet Sacrifice")'},{'title': "Call Me When You're Sober",'description':'Amy Lee, Terry Balsamo','link':'javascript:show("Call Me When You\'re Sober")'},{'title':'Weight of the World','description':'Amy Lee, Terry Balsamo','link':'javascript:show("Weight of the World")'}]}
- ]},
- {'title':'Pop Music', 'description':'Pop Albums', 'icon':'/mytreeapp/resources/avatars/a2.png','items':[
- {'title':'Millennium (1999)', 'description': 'Backstreet Boys','items':[{'title':'Larger than life','description':'Littrell, Lundin, Martin, Orpin','link':'javascript:show("Larger than life")'},{'title':"I Want It That Way",'description':'Carlsson, Martin, Orpin','link':'javascript:show("I Want It That Way")'},{'title':"Show Me the Meaning of Being Lonely",'description':'Crichlow, Martin','link':'javascript:show("Show Me the Meaning of Being Lonely")'}]},
- {'title':'Baby one more time (1999)', 'description': 'Britney Spears','items':[{'title':'...Baby One More Time','description':'M.Martin','link':'javascript:show("...Baby One More Time")'},{'title':'Sometimes','description':'J. Elofsson, P. Magnusson, D. Kreuger, M. Martin','link':'javascript:show("Sometimes")'},{'title':'From the Bottom of My Broken Heart','description':'E. Foster White','link':'javascript:show("From the Bottom of My Broken Heart")'}]},
- {'title':'Escape (2001)', 'description': 'Enrique Iglesias','items':[{'title':'Escape','description':'DioGuardi,Iglesias,Morales,Siegel','link':'javascript:show("Escape")'},{'title':"Don't Turn Off the Lights",'description':'DioGuardi,Iglesias,Morales,Siegel','link':'javascript:show("Don\'t Turn Off the Lights")'},{'title':'Hero','description':'Taylor,Iglesias,Barry','link':'javascript:show("Hero")'}]}
- ]}
- ]
- iris.json(data)
<window>
<script>
function show(text)
{
document.getElementById('song_title').innerHTML="" ;
document.getElementById('song_title').innerHTML=te xt;
}
</script>
<center><box title='Demo Tree' style="width:400px">
<div style="text-align:left;overflow:auto;height:300px;" >
<tree id="mytree" url="/mytreeapp/tree" />
</div>
</box>
<br/>
<box title="Song Title" style="width:500px;">
<div id='song_title'>
</div>
</box>
</center>
</window>
REGARDS,
Preet kanwal Singh