Creating custom pages
Simple query of a certain data point
Example
The simplest form of a query is (see Example HTML References):
<html>
<title> This is the simplest test </title>
Value: <%?"ExampleDP_Result."%>
</html>
Example of HTML page with $parameters
In order to create your own pages, use one of the common HTML editors such as MS Frontpage, DreamWeaver or MS Word or any text editor (only for advanced HTML programmers). Refer to the respective product descriptions for details on creating HTML pages.
The following example shows how to generate simple HTML queries using, for example, MS Word.
Example
-
For example, write the following code in your document:
This is data point ExampleDP_Arg1: <%?"ExampleDP_Arg1."%>
// Query the value of a fixed data point
And this is data point <%$dp2%> and its value: <%?$dp2"%>
// Query any data point with dollar parameter. The //$parameters are resolved when the page is displayed in the browser
-
Save the document under
Example.html
in the directory<proj_path>/data/http/en/refs
. -
Open the file
Example.html
in Word again. -
Assign the paragraph format HTML Markup to those text areas to be replaced with the parameters.
-
Save the page again.
-
In the project directory refs change the file name to Example.htmlRef.
-
Load the page in the browser by entering the following address:
http://localhost/WinCC OA?ref=refs/Example.htmlRef&dp2=ExampleDP_Arg2
http://localhost/WinCC OA?ref=refs/Example.html&dp2=ExampleDP_Arg2
-
Depending on your online values, the following page will be displayed:
The following parameters are passed when you load the page:
-
localhost - the host name of the computer running the HTTP Server
-
WinCC OA? - the query to WinCC OA whether the desired reference exists in the specified directory.
-
dp2 - the $parameter is resolved. You can use any other data point instead of ExampleDP_Arg2. If you pass multiple parameters, the syntax is: &dp1=Test1&dp2=Test2, etc.
Example of HTML page with $parameters and CTRL script
The following HTML code is an example of a script in an HTML page. Data points are passed both as fixed parameters and as $parameters in this example, too.
Example
-
This page has been created with a common HTML editor. Save the page under:
<proj_path>/data/http/en/refs/testHTML.htmlRef
. -
Create a data point type Test with an element type "float" for the data points testDp1 and testDp2. You can observe changes in their online values when you load the page again.
-
The dollar parameters are resolved in the browser address box. The corresponding link is: http://localhost/WinCC OA?ref=refs/testHTML.html&dp1=testDp1&dp2=testDp2
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="Microsoft Word 97">
<TITLE>HTML Reftest</TITLE>
</HEAD>
<BODY>
<FONT SIZE=7><P ALIGN="CENTER">HTML Reftest</P>
</FONT></BODY>
<P ALIGN="CENTER"></P>
<P>Funktionen : Zeit <%=http_currentTime()%></P>
<P>Funktion : Rechnen <%=http_multi(3.1,3.1)%></P>
<P>Dollarparameter $dp1=<%$dp1%> $dp2=<%$dp2%></P>
<P>Abfrage DP(statisch)
<%$dp1%>=<%?"testDp1.:_online.._value"%></P>
<P>Abfrage DP(dollar) $dp1=<%?$dp1+".:_online.._value"%>
$dp2=<%?$dp2+".:_online.._value"%></P>
<P>Controlscript <%={ //Skriptaufruf eines normalen CTRL-Skripts
string text;
float value;
dpGet($dp1+".:_original.._value", value ); //dpGet Abfrage
text="Beispiel mit dollar dp1:"+value;
return(text);
}%></P>
</HTML>