Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/02/2008, 04:32
JuliusRomo
 
Fecha de Ingreso: noviembre-2007
Mensajes: 11
Antigüedad: 16 años, 6 meses
Puntos: 0
Insertar un SVG mediante variables

Saludos a todos. Estoy empezando a manejarme con los SVG, pero no se si es posible realizar operaciones del tipo que necesito ahora.

Supongamos que tengo un SVG sencillote, del estilo:

Código:
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<rect width="300" height="100"
style="fill:rgb(0,0,255);stroke-width:1;
stroke:rgb(0,0,0)"/>

</svg>
Donde yo quiero que el width, height, etc, sean variables, tomando los datos de, en este caso, un php.

Ejemplo del "trozo" de php:

Código:
$ancho=20;
$alto=60;

$ancholinea=4;
Que lleve a tener un svg parecido a esto:

Código:
<svg width="100%" height="100%" version="1.1"
xmlns="http://www.w3.org/2000/svg">

<rect width="$ancho" height="$alto"
style="fill:rgb(0,0,255);stroke-width:$ancholinea;
stroke:rgb(0,0,0)"/>

</svg>
Se que no se hace asi, pero me gustaria que me orientaran sobre cual seria la forma de ponerlo en el svg...

Muchas gracias de antemano.