Hi everybody, first at ll sorry if my english is not the best. I''m trying to implement this javascript in my aplication: http://www.ribosomatic.com/articulos/barra-de-calificacion-con-estrellas-rating-star-con-javascript-yui/ It´s a simple start rating implemented with javascript. There´s no problem because I put it in public/javascripts and i can call them in my application.html.rb but there´s one problem. I have this in my view: . . . <form name="test" action="" method="post"> <input type="hidden" id="input-rating" name="input-rating" value="<?= $_POST["input-rating"] ?>" /> <div id="rater" class="rater"> <div id="stars"></div> <div class="clear"></div> </div> <input name="submit" type="submit" value="Votar" /> </form> <?php if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif ?> <script language="javascript"> var pValue = ''<?= $_POST["input-rating"] ?>''; var r = new rating(''stars'', 5, pValue || 0 , true, ''input-rating''); </script> . . . I don´t know PHP, and I understant this lines: <?php if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif ?> Anybody that works with PHP too can says me the equivalence for rails?? -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, 26 Mar 2009 18:05:54 +0100 Jose vicente Ribera pellicer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I don´t know PHP, and I understant this lines: > <?php > if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif > ?> > > Anybody that works with PHP too can says me the equivalence for rails??Post parameters are available in the view via the params method. Are you seriously trying to put PHP code in your views? Or do you want to port the php to ruby? SH -- Starr Horne Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/ --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Are you > seriously trying to put PHP code in your views? Or do you want to port > the php to ruby? > > SHI want to port the php, but i am a begginer developper and i only program with RoR. I don''t know how to port it to my rails application :( -- 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 -~----------~----~----~----~------~----~------~--~---
Jose vicente Ribera pellicer wrote:>> Are you >> seriously trying to put PHP code in your views? Or do you want to port >> the php to ruby? >> >> SH > > > I want to port the php, but i am a begginer developper and i only > program with RoR. I don''t know how to port it to my rails application :(I try with this: <%- if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif %> but firefox shows me this error: SyntaxError in Videos#show Showing videos/show.html.erb where line #17 raised: compile error /Users/jose/mimandote.com/app/views/videos/show.html.erb:17: syntax error, unexpected tGVAR _erbout.concat(( if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif ).to_s); _erbout.concat "\n" ^ /Users/jose/mimandote.com/app/views/videos/show.html.erb:17: syntax error, unexpected '')'', expecting kEND _erbout.concat(( if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif ).to_s); _erbout.concat "\n" ^ /Users/jose/mimandote.com/app/views/videos/show.html.erb:35: syntax error, unexpected $end, expecting '')'' Extracted source (around line #17): 14: <input name="submit" type="submit" value="Votar" /> 15: </form> 16: 17: <%= if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif %> 18: 19: <script language="javascript"> 20: var pValue = ''<?= $_POST["input-rating"] ?>''; :( -- 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 -~----------~----~----~----~------~----~------~--~---