Mam pytanko w jaki sposób zrobić odnisienie do współrzędnych cx i cy tak aby wartości były pobierane ze zmiennych $x=42 i $y=-236. W przyszłości wartości mają być pobierane z tablicy, ale już na samym początku mam problem. Jeśli zamiast cx="<?=$x;?>" wstawi się cx="42" tp wszystko działa normalnie ale bez odniesienia.
oto skrypt:
<?php
header("Content-type: image/svg-xml"); echo '<?xml version="1.0" standalone="no"?>'; ?>
<svg width="800" height="800">
<g id="graph0" class="graph" transform="scale(1.33333 1.33333) rotate(0) translate(4 334)">
<polygon style="fill:white;stroke:white;" points="-4,4 -4,-334 341,-334 341,4 -4,4"/>
<script type="text/javascript"> <![CDATA[
function zmien(id, atrybut, wartosc)
{element = evt.getTarget().getOwnerDocument().getElementById(id);
element.setAttribute(atrybut, wartosc);}
]]></script>
/>
<?php
$x=42;
$y=-236;
?>
<g>
<ellipse id="w1" cx="<?=$x;?>" cy="-236" rx="20" ry="18"
fill="yellow" stroke="green" stroke-width="0.04cm"
onmouseover="zmien('w1','stroke','red');"
onmouseout="zmien('w1','stroke','green');"
/>
<a xlink:href="http://www.wp.pl" xlink:title="MK">
<text text-anchor="middle" x="42" y="-236"
style="font:Arial; font-size:7.34pt; ">A</text>
</a>
<ellipse id="w2" cx="292" cy="-239" rx="20" ry="20"
fill="yellow" stroke="green" stroke-width="0.04cm"
onmouseover="zmien('w2','stroke','red');"
onmouseout="zmien('w2','stroke','green');"
/>
<a xlink:href="http://www.wp.pl" xlink:title="MK">
<text text-anchor="middle" x="292" y="-236"
style="font:Arial; font-size:7.34pt; ">B</text>
</a>
</g>
<g id="edge1" class="edge">
<path fill="green" stroke="green" stroke-width="1.5"
d="M 62 -239 L 272 -239 z
M 265 -241 L 265 -237 L 272 -239 z" transform="rotate(0 42 -239)"/>
</g>
<g id="edge2" class="edge">
<path fill="green" stroke="green" stroke-width="1.5"
d="M 62 -239 L 272 -239 z
M 265 -241 L 265 -237 L 272 -239 z" transform="rotate(90 42 -239)"/>
</g>
</svg>