Re: template, markaby question
Well, the elegant (and perhaps philosophically correct) way is to use Markaby. In general, I try to avoid placing raw HTML into my Ruby code. If you don't want to rewrite your HTML, you can use ERB templates. Without being redundant, more info on how to make this work can be found here: http://rubyforge.org/pipermail/camping-list/2010-August/001413.html Disclaimer: I haven't tried it myself. -- Trevor Johns http://tjohns.net -- Trevor Johns http://tjohns.net On Monday, August 13, 2012 at 8:44 PM, gurugeek wrote: hello, I am trying to have some simple HTML to be used as a placeholder page for new servers users in a small camping application (basically with using the main site layout plus the current date and time :) )and I was wondering if the correct way is to rewrite the whole html using markaby or I should use the hack def layout text ' html inside where the only ruby code would be Today is '+Time.now.asctime+' ' or if there is any way that I don't know to have inline templates/use erb ? thanks a lot ! Best Regards David ___ Camping-list mailing list Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org) http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: template, markaby question
See magnus's post at http://rubyforge.org/pipermail/camping-list/2010-August/001413.html for info on using the haml and erb support built in to Camping. Also note that you don't need to 'render' anything. You can just set @body to whatever string you want in your controller, or even return an IO or Array of stuff to turn in to strings. If you return an IO like a file or an a url opened with open-uri the server will automatically stream out the information. — Jenna On Tuesday, 14 August 2012 at 1:44 PM, gurugeek wrote: hello, I am trying to have some simple HTML to be used as a placeholder page for new servers users in a small camping application (basically with using the main site layout plus the current date and time :) )and I was wondering if the correct way is to rewrite the whole html using markaby or I should use the hack def layout text ' html inside where the only ruby code would be Today is '+Time.now.asctime+' ' or if there is any way that I don't know to have inline templates/use erb ? thanks a lot ! Best Regards David ___ Camping-list mailing list Camping-list@rubyforge.org (mailto:Camping-list@rubyforge.org) http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list
Re: template, markaby question
Jenna - Trevor, many thanks for this. It works fine but perhaps I should stick to markaby for the example page so it would be easier to have everything in one file and new users can learn how to use it? Best Regards David On Aug 14, 2012, at 6:28 AM, Jenna Fox a...@creativepony.com wrote: See magnus's post at http://rubyforge.org/pipermail/camping-list/2010-August/001413.html for info on using the haml and erb support built in to Camping. Also note that you don't need to 'render' anything. You can just set @body to whatever string you want in your controller, or even return an IO or Array of stuff to turn in to strings. If you return an IO like a file or an a url opened with open-uri the server will automatically stream out the information. — Jenna On Tuesday, 14 August 2012 at 1:44 PM, gurugeek wrote: hello, I am trying to have some simple HTML to be used as a placeholder page for new servers users in a small camping application (basically with using the main site layout plus the current date and time :) )and I was wondering if the correct way is to rewrite the whole html using markaby or I should use the hack def layout text ' html inside where the only ruby code would be Today is '+Time.now.asctime+' ' or if there is any way that I don't know to have inline templates/use erb ? thanks a lot ! Best Regards David ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list ___ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list