Hi,
The below code is my global layout..code I would like to include a if
statement in it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en">
<head>
<meta http-equiv="content-type"
content="text/html;charset=UTF-8" />
<title>Languages: <%= controller.action_name %></title>
<%= stylesheet_link_tag ''scaffold'' %>
</head>
<body>
<p style="color: green">
<% if flash[:notice].empty? then puts flash[:message]%></p>
<%= yield %>
</body>
</html>
whats wrong with the if statement here..?
Thanks in advance,
Sharma
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
> <% if flash[:notice].empty? then puts flash[:message]%></p>> whats wrong with the if statement here..?puts won''t work in rhtml. You can try this: <%= flash[:message] if flash[:notice].empty? %> Regards, Rimantas -- http://rimantas.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
think i read somewhere that "puts" should not be used in templates. use <%= flash[:message] if flash[:notice].empty? %> On 1 Mrz., 11:15, Sharma Chelluri <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > > The below code is my global layout..code I would like to include a if > statement in it. > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > <head> > <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> > <title>Languages: <%= controller.action_name %></title> > <%= stylesheet_link_tag ''scaffold'' %> > </head> > <body> > > <p style="color: green"> > <% if flash[:notice].empty? then puts flash[:message]%></p> > > <%= yield %> > > </body> > </html> > > whats wrong with the if statement here..? > > Thanks in advance, > Sharma > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the help. Thorsten wrote:> think i read somewhere that "puts" should not be used in templates. > > use > > <%= flash[:message] if flash[:notice].empty? %> > > On 1 Mrz., 11:15, Sharma Chelluri <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 1, 2007, at 5:15 AM, Sharma Chelluri wrote:> Hi, > > The below code is my global layout..code I would like to include a if > statement in it. > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > <head> > <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> > <title>Languages: <%= controller.action_name %></title> > <%= stylesheet_link_tag ''scaffold'' %> > </head> > <body> ><p style="color: green"> <% if flash[:notice].empty? %> <%= flash[:message] %> <% end %> </p>> <%= yield %> > > </body> > </html> > > > whats wrong with the if statement here..? > > Thanks in advance, > SharmaYou need to use <%= %> to get output from ERb and (as others have said) you don''t use puts in templates. You''re Welcome, -Rob Rob Biedenharn http://agileconsultingllc.com Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---