Hi,
To create a graph i am passing table like bellow
htmloutput=’
<td class=“graphable” id=“absolute:data:data1:”>9
10 |
'
now problem is, the value comes from variables like this :
#{hash[“1”]}
but when i use this variables inside ’ ', its coming as a text like
htmloutput=’
<td class=“graphable”
id=“absolute:data:data1:”>#{hash[“1”]} <td class=“graphable”
id=“absolute:data:data1:” >#{hash[“1”]}
’
how do i convert it to value ??
i might be very silly but i am not seeing any light!!
thanks for help
You normally need to use double-quoted strings to use interpolation.
However, since your string contains double-quotes, I would recommend
using a heredoc or using %Q
htmloutput=%Q|
<td class=“graphable”
id=“absolute:data:data1:”>#{hash[“1”]} <td class=“graphable”
id=“absolute:data:data1:” >#{hash[“1”]}
|
Hi
Thanks
i just tried that, its works but problem is,
its removing “” from html example when its generating the page, if i see
view source , i see this
9 |
but in the html page it should come like this
9 |
does it make sense ??
reason, to create a graph by using this gaphable, that needs to be
inside “”
please advise… i am stuck …
Some thing like perl
$htmloutput.=
“
RX-bytes | <td class=“graphable”
id=“counter:$dev:rx-bytes”>”.$ifd[0]."
\n"
.“
RX-packets | <td class=“graphable”
id=“counter:$dev:rx-packets”>”.$ifd[1]."
\n"
."\n"
."
".$out."
\n";
same type of concept for ruby …
hope it make sense …
The interpolation should be fine, as demonstrated below. Presumably
whatever you’re using to create the html file is removing your quotes,
but you haven’t given any information on that process.
1:0> hash = {‘1’ => ‘test’}
=> {“1”=>“test”}
2:0> htmloutput=%Q|
3:0" <td class=“graphable”
4:0" id=“absolute:data:data1:”>#{hash[“1”]} <td class=“graphable”
5:0" id=“absolute:data:data1:” >#{hash[“1”]}
6:0" |
7:0> puts htmloutput
<td class="graphable"
id=“absolute:data:data1:”>test
test |