Re: [cgi-prototype-users] Reusable Components
> "Jim" == Jim Brandt <[EMAIL PROTECTED]> writes: Jim> And for what it's worth, CGI::Prototype::Hidden adds some nice Jim> features, so you may consider checking that out. Yeah, I should probably make it clearer that CGI::Prototype starts a bit too close to the metal. CGI::Prototype::Hidden (and the upcoming "when I get a few more tuits" CGI::Prototype::Pathinfo) are a much better starting framework for a "real" app. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! --- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix ___ cgi-prototype-users mailing list cgi-prototype-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users
Re: [cgi-prototype-users] Reusable Components
> "Matthew" == Matthew Browning <[EMAIL PROTECTED]> writes: Matthew> On Thursday 28 April 2005 06:25, LD wrote: >> >> What's the best way of including the output of Header and Footer in >> the render phase - i.e., as if you'd concated the output of: Header-> activate; Main->activate; Footer->activate; >> >> Any thoughts? >> Matthew> The functionality you're after is suggested in the docs of Matthew> CGI::Prototype::Hidden, here (link will probably wrap): Matthew> http://search.cpan.org/~merlyn/CGI-Prototype-0.9052/lib/CGI/Prototype/Hidden.pm#MANAGEMENT_SLOTS Matthew> I'd go easy using anything marked as `experimental' but I've had a go at Matthew> using this feature, purely as a point of interest, and it does work. Matthew> Be nice to see how this develops. Or, do as I've done, and put all that in WRAPPER.tt - you can do an amazing amount there. I've just finished a seriously fleshed out medium size project with CGIP, and I'm probably going to take my "this works, that doesn't" thoughts and put them into CGI::Prototype::Cookbook. For example, my top level class was GC::App... so I created GC/ttlib to hold all my INCLUDE'd files, because they'd sit alongside the rest of my app, but not get in the way of the files in GC/App/*.tt, which I reserved purely for state-based pages. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! --- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix ___ cgi-prototype-users mailing list cgi-prototype-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users
Re: [cgi-prototype-users] Reusable Components
For standard header/footer stuff for pages, we take care of this on the template side since this tends to be view-like information. We put it in our wrapper.tt (along with error-handling code) so it gets run for each page. Then each page.tt only needs to handle display duties for the middle part of the page. With Template Toolkit, you can use INCLUDE to pull in other templates easily in the display phase. If you have dynamic data in your headers and footers, you can handle that a few ways. The easiest is probably to add subs to your App.pm base class and call back to them from TT. Since self is sent to the template, you can call any of the methods from there. Another way is to create new slots, generate the data in your pm files, stick the data in the slot, then reference it from the Template. In general, I've found that one pm = one page, so you usually won't create separate pm files for smaller components. If it is a shared component, you can stick it in App.pm. And for what it's worth, CGI::Prototype::Hidden adds some nice features, so you may consider checking that out. Hope this helps. Jim On Apr 28, 2005, at 1:25 AM, LD wrote: Hi there, obviously an active list :-) Anyway - I'm so far really liking CGI::Prototype (with its simple MVC implementation) but what I'm not clear on is the best way to incorporate Reusable Components. Say you've got the following components which all inherit from CGI::Prototype... Header: (reusable) /Header.pm /Header.tt Various Pages: /Main.pm /Main.tt /Login.pm /Login.tt <...> Footer: (reusable) /Footer.pm /Footer.tt ...and somecgi.cgi which basically does Main->activate; What's the best way of including the output of Header and Footer in the render phase - i.e., as if you'd concated the output of: Header->activate; Main->activate; Footer->activate; Any thoughts? Cheers, LD --- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix ___ cgi-prototype-users mailing list cgi-prototype-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users == Jim Brandt Administrative Computing Services University at Buffalo --- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix ___ cgi-prototype-users mailing list cgi-prototype-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users
Re: [cgi-prototype-users] Reusable Components
On Thursday 28 April 2005 06:25, LD wrote: > > What's the best way of including the output of Header and Footer in > the render phase - i.e., as if you'd concated the output of: > Header->activate; Main->activate; Footer->activate; > > Any thoughts? > The functionality you're after is suggested in the docs of CGI::Prototype::Hidden, here (link will probably wrap): http://search.cpan.org/~merlyn/CGI-Prototype-0.9052/lib/CGI/Prototype/Hidden.pm#MANAGEMENT_SLOTS I'd go easy using anything marked as `experimental' but I've had a go at using this feature, purely as a point of interest, and it does work. Be nice to see how this develops. MB -- http://matthewb.org/public_key.txt --- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix ___ cgi-prototype-users mailing list cgi-prototype-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users