X-600M Users Manual
Appendix H: Custom Web Pages
1: {if $user->hasAccess(255)}
2: {$io->load()}
3: <html>
4: <head><title>Example</title></head>
5: <body><p>{$io->desc("owSensor1")}<p></body>
6: </html>
7: {/if}
Line 1:
Checks to see if the user that is logged in can access this web page. It does this by calling the
hasAccess()
function of the $user object. The
hasAccess
function takes as a parameter an access
mask. Each bit in this mask represents one of the
User Access
groups.
Bit
Access Group Decimal Representation
1
admin
1
2
user
2
3
group1
4
4
group2
8
5
cbw
16
The way this works is that if the currently logged-in user belongs to at least one of the
Access Groups
specified in the access mask (in this example 255, or any group), that user will be able to view the page.
Line 1:
To create a page that only should be visible to the admin, you would use this for line 1:
{if $user->hasAccess(1)}
To create a page that should only be visible by the user access group, you would use this for line 1:
{if $user->hasAccess(2)}
Line 2:
Will cause the template engine to load information about all the registered I/O on the X-600M.
The load function must be called for each object that is to be later used in the template.
Lines 3 and 4:
Basic HTML.
Line 5:
Contains the {tag} that will insert the description of a 1-Wire temperature sensor into the web
page. There are a few different values that we might be interested in seeing on the web page for this
sensor such as the units and the description. In this example we are only interested in the description.
To get the description of the 1-Wire temperature sensor, we call the
desc
function on the $io object and
pass it the name of the I/O we are interested in. In this case we are interested in the I/O with the name
“owSensor1”, hence {$io->desc(“owSensor1”)}
The following table lists all the objects and each of its functions/properties.
Note:
Functions end with () and generally require a parameter. They are used to access the property of
an io, reg, etc by that io's name. Properties do not end with (), and can only be used inside foreach
loops.
Object Function
Property
Description
$io
load()
n/a
Load I/O information from
settings.
desc(“ioName”)
desc
Get the description of the I/O
named
ioName
units(“ioName”)
units
Get the units of the I/O named
Xytronix Research & Design, Inc.
Page 139
Содержание X-600M
Страница 1: ...X 600MTitle Page Goes Here...
Страница 6: ...X 600M Users Manual Page 4 Xytronix Research Design Inc...
Страница 99: ...X 600M Users Manual Setup Pages Xytronix Research Design Inc Page 97...
Страница 116: ...Appendix B Installing New Firmware X 600M Users Manual Page 114 Xytronix Research Design Inc...