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/.
> 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/
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"] ?>';