/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/examples/example7.php
ViewVC logotype

Annotation of /nfo/php/libs/com.newsblob.phphtmllib/examples/example7.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Thu Jan 30 03:29:43 2003 UTC (21 years, 6 months ago) by jonen
Branch: MAIN
Branch point for: no_vendor_tag
Initial revision

1 jonen 1.1 <?php
2     /**
3     * Another example of how to build an
4     * SVG Image with phpHtmlLib.
5     * SVG = Scalable Vector Graphics.
6     * that phpHtmlLib provides.
7     *
8     *
9     * $Id: example7.php,v 1.1 2002/11/09 00:01:38 hemna Exp $
10     *
11     * @author Walter A. Boring IV <waboring@buildabetterweb.com>
12     * @package phpHtmlLib
13     * @subpackage examples
14     * @version 2.0.0
15     *
16     */
17    
18     /**
19     * Include the phphtmllib libraries
20     */
21     include_once("includes.inc");
22     include_once($phphtmllib."/widgets/SVGDocumentClass.inc");
23    
24     //build the SVG Document object and set the
25     //width=400, height=200 attributes on the 'svg' root
26     //xml tag;
27     $svgdoc = new SVGDocumentClass(400,200);
28    
29     //build and add a css class
30     $style = svg_style("text/css", "/*this is a test*/");
31     $style->add( ".mylink {\n color: #000000;\n".
32     "text-decoration:underline;\n".
33     "font-size:20;\n }");
34     $svgdoc->add( $style );
35    
36     //add a nice line around it all
37     $rect = svg_rect(0,0,400,200,"none","black",1);
38     $svgdoc->add( $rect );
39    
40     //build the circle
41     $g = svg_g("stroke:black", "translate(190 80)");
42     $circle = svg_circle(0,0,50,"blue", "black", 2);
43    
44     //add a neat mouseover to the circle
45     $circle->set_tag_attribute("onmouseover=\"evt.target.setAttribute('style', 'stroke:red; stroke-width:2');\"");
46     $circle->set_tag_attribute("onmouseout=\"evt.target.setAttribute('style', '');\"");
47     $g->add( $circle );
48     //add it to the image
49     $svgdoc->add( $g );
50    
51     $g2 = svg_g("", "translate(100 80)");
52     $text = svg_text(0,80,NULL,NULL, "SVG built by");
53     $text->set_style("font-size:20;");
54     $linktext = svg_text(114,80,NULL,"mylink","phpHtmlLib");
55    
56     //$linktext->set_style("font-size:20;color:#FF0000;text-decoration:underline;");
57    
58     $link = svg_a("http://phphtmllib.newsblob.com", $linktext);
59     $g2->add( $text, $link );
60     $svgdoc->add( $g2 );
61    
62     print $svgdoc->render();
63     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed