Blame | Letzte Änderung | Log anzeigen | RSS feed
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-iso-8859-1"><LINK REL="Start" HREF="index.html"><LINK REL="Contents" HREF="toc.html"><LINK REL="Prev" HREF="72Specifyingtargetsforimagemapplots.html"><LINK REL="Next" HREF="74ExamplesofImagemaps.html"><STYLE TYPE="text/css"><!--BODY { font-family: serif }H1 { font-family: sans-serif }H2 { font-family: sans-serif }H3 { font-family: sans-serif }H4 { font-family: sans-serif }H5 { font-family: sans-serif }H6 { font-family: sans-serif }SUB { font-size: smaller }SUP { font-size: smaller }PRE { font-family: monospace }A { text-decoration: none }--></STYLE></HEAD><BODY><A HREF="toc.html">Contents</A><A HREF="72Specifyingtargetsforimagemapplots.html">Previous</A><A HREF="74ExamplesofImagemaps.html">Next</A><HR NOSHADE><H2><A NAME="7_3">7.3 Using StrokeCSIM()</A></H2><P> The simplest way of creating a creating a CSIM image is with theStrokeCSIM() method. As mentioned before this method actually returns a(small) HTML page containing both the image-tag as well as the imagemap specification. Hence it is<B> not</B> possible to use a script thatends with this method in a standard image-tags src property.</P><P> There are two ways to create CSIM (or get hold of) the image maps</P><OL><LI> Use the CSIM image script as the target in a standard anchorreference, for example <CODE><PRE><a href="mycsimscript.html"></PRE></CODE> This has the drawback that the image page will only contain theimage and nothing else.</LI><LI> The other way will allow the image script to be included in anarbitrary HTML page by just including the image script at the wantedplace in the HTML page using any of the standard "include" phpstatement. For example <CODE><PRE><h2> This is an CSIM image </h2><?phpinclude "mycsimscript.php"?></PRE></CODE></LI></OL><P><DIV class="note"><B>Note:</B> If there are several CSIM images onthe same page it is necessary to use "include_once" in the scripts forthe inclusion of "jpgraph.php" and the other jpgraph library filessince the files will be included multiple times on the same page andone or more "Already defined error" will be displayed.</DIV></P><P> The process to replace Stroke() with StrokeCSIM() is strait forward.Replace all existing calls to Stroke() with the equivalent calls toStrokeCSIM().</P><P> The only difference is that it is necessary ti supply a minimum ofone file name in the StrokeCSIM() method. The first argument must bethe name of the actual image script file including the extension. Sofor example if the image script is called "mycsimscript.php" it isnecessary to write<BR> <DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $graph</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">StrokeCSIM</FONT><FONT color="#007700">(</FONT><FONT color="#DD0000">'mycsimscript.php'</FONT><FONT color="#007700">)</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P><BR> However, it is possible to apply a small "trick" here. PHP maintaina special variable called "__FILE__" which is always set to the currentfile name. This means you could use the following construction:</P><P><DIV class="phpscript"><CODE><FONT color="#000000"> <FONT color="#0000BB"> $graph</FONT><FONT color="#007700">-></FONT><FONT color="#0000BB">StrokeCSIM</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">basename</FONT><FONT color="#007700">(</FONT><FONT color="#0000BB">__FILE__</FONT><FONT color="#007700">))</FONT><FONT color="#0000BB"></FONT></FONT></CODE></DIV></P><P>This is a better way since the script can now be renamed withouthaving to change any code in the file which otherwise would be needed.<DIVclass="note"><B>Note:</B> Why does the script name need to be used asthe first parameter? The reason is that in the creation of the HTMLpage which is sent back we need to refer to the script in the imagetag. So why is it not possible to use the PHP_SELF reference? Theproblem with PHP_SELF is that in the case where we include theimage-script in an HTML page and use the PHP_SELF we will get the nameof the HTML page and not the actual script in which the PHP_SELF isused. We also can not use the __FILE__ trick in the library since inthe context __FILE__ is set to "jpgraph.php". Hence, this must bespecified by the client as shown above.</DIV></P><P> The other arguments to StrokeCSIM() are optional. Please note thatif several CSIM images are used in the same HTML page it is alsonecessary to specify the image map name as the second parameter sinceall image maps must be unique to properly match each image map againsteach image. Please consult the class reference <A href="../ref/Graph.html#_GRAPH_STROKECSIM">StrokeCSIM()</A> for more details.</P><HR NOSHADE><A HREF="toc.html">Contents</A><A HREF="72Specifyingtargetsforimagemapplots.html">Previous</A><A HREF="74ExamplesofImagemaps.html">Next</A></BODY></HTML>