Re: [Myghty-users] Help on template components and methods
Brought to you by:
zzzeek
From: Huy Do <hd...@si...> - 2006-02-17 07:07:38
|
Michael Bayer wrote: > is the issue that you dont like page.myt having to know about menu.myt ? Not so much menu.myt but menu.myt:head. I am really only talking about html here, so this won't apply to any non-html myghty applications. Components should be made up of two things. Any head stuff (javascript, css) and the actual markup. I would like the components to be able to specify in itself what head stuff to add and also the markup. Any templates using the components should only have to say <& mycomponent, parameter=myparameters &>. The component should then be able to render everything it needs to work properly including the head stuff. > where would you like to indicate to the autohandler that menu.myt > should be used ? you can also use things like attributes, etc. to > change how youre doing it, but not sure if thats "cleaner", i.e. > > - autohandler - > % m.comp(self.attributes['header']) > > - page.myt - > <%attr> > header='menu.myt:header' > </%attr> > Can I set the header attribute in menu.myt and how will inheritance work ? i.e if I want add multiple 'header' attributes from multiple components ? > theres a lot of ways you can style it... > > On Feb 16, 2006, at 9:03 AM, HD Mail wrote: > >> Hi, >> >> I'm not sure how to word this question but here's my example. I have >> an autohandler, a template (page.myt) and a component (menu.myt). I >> want to be able to get the component to add stuff into areas of my >> autohandler (namely the <head>) . My solution is below, but I was >> wondering if there is a cleaner way of doing this from the page.myt. >> Ideally I just want to call <& menu.myt &> and have it handle the >> head section. >> >> autohandler >> <html> >> <head> >> <& SELF:head &> >> </head> >> <body> >> % m.call_next() >> </body</html> >> >> I have a page with >> >> page.myt >> <& menu.myt &> >> <%method head> >> <& menu.myt:head &> >> </%method> >> >> menu.myt >> <%args>menu</%args> >> <ul><li>menu item</li></ul> >> <%method head> >> <script src="menu.js"></script> >> </%method> >> >> >> >> Thanks >> >> Huy >> >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. Do you grep through >> log files >> for problems? Stop! Download the new AJAX search engine that makes >> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 >> _______________________________________________ >> Myghty-users mailing list >> Myg...@li... >> https://lists.sourceforge.net/lists/listinfo/myghty-users |