PSTags HTML
PSTags HTML
"PS-HTML" or "PowerSchool HTML" is the term given to the language used to write traditional PowerSchool
pages. It consists of HTML with special PowerSchool tags interspersed. These tags usually have one of the
formats ~(tag) or ~[tag]. They essentially perform server-side operations that can modify the page results
being sent out to the user's browser.
There are many, many PS-HTML tags supported by PowerSchool. This page documents some of the most
useful ones.
System Tags
Tag Available Description/Example
~(curstudid) Admin Displays the students id of the record that was referenced on page
Teachers load.
Guardian Example: 1234
Student
Subs
~(curtchrid) Admin Displays the teacher id of the record that was referenced on page load.
Teachers Example: 4567
~[x:userid] Admin Displays the ID of the currently logged in user. For Guardian the current
Teachers student ID is returned.
Guardian Example: 1234
Student
Subs
~[x:users_dcid] Admin Displays the users dcid (Teachers.Users_DCID) of the currently logged
Teachers in Teacher/Administrator.
Example: 1234
Tag Available Description/Example
~[x:usersroles] Admin Displays the group number, or group numbers if using multiple roles, of
Teachers the currently logged in Teacher/Administrator in a comma separated
list.
Example: 9 or 9,10,30
~[x:version;full] (10+) Admin Displays the full PS version number for beta/internal builds.
Teachers Example: 9.2.4.0.1040000.2123
Guardian
Student
Subs
Field DATs
DATs (Data Access Tags) are special tags designed to return a specific data element in current processing. A
typical use is to return a column value from the table that the current page is processing, but there are other
types of DATs also. Here are the formats for specific database field display DATs.
Tag Field Type Description/Example
IF Statements
Each of these statements has the following form:
~[if.CONDITION]
True Content
[else]
False Content
[/if]
The line breaks are optional and do not affect the result (except that line breaks will be in the result also).
Please note that PS-HTML tags do not nest normally; if you want to nest one "if" inside another, you need to
use the following type of construct:
~[if#cond1.CONDITION1]
~[if#cond2.CONDITION2]
True Content for both conditions
[else#cond2]
False Content for condition 2 (only!)
[/if#cond2]
[else#cond1]
False Content for condition 1 only
[/if#cond1]
Conditions must be a simple conditional (i.e. "AND", "OR", or other Boolean operations are not allowed).
Among the most useful of the available conditions are the following:
security.inrole={group_number} Admin Tests if a user belongs to at least one of the defined groups.
Teachers Example:
~[if.security.inrole=1,2,3,4,9,20]
True if part of one of these security groups/roles
(1,2,3,4,9,20)
[/if]
security.pagemod={path/page} Admin Tests if the currently logged in user has modify access to
the page.
Example:
~[if.security.pagemod=/admin/students
/generaldemographics.html]
<a href="generaldemographics.html?frn=~
(studentfrn)">Demographics</a>
[/if]
security.pageview={path/page} Admin Tests if the currently logged in user has view access to the
page.
Example:
~[if.security.pageview=/admin/students
/generaldemographics.html]
<a href="generaldemographics.html?frn=~
(studentfrn)">Demographics</a>
[/if]
security.pagenone={path/page} Admin Tests if the currently logged in user has no access to the
page.
Example:
~[if.security.pagenone=/admin/students
/generaldemographics.html]
No Access
[else]
<a href="generaldemographics.html?frn=~
(studentfrn)">Demographics</a>
[/if]
security.canmodifyfield= Admin Tests if the currently logged in user has modify access to
{Table.Field} the Table.Field.
Example:
~[if.security.canmodifyfield=Students.DOB]
Full Access
[/if]
security.canviewfield= Admin Tests if the currently logged in user has view access to the
{Table.Field} Table.Field.
Example:
~[if.security.canviewfield=Students.DOB]
View Acess or Possibly Modify
[/if]
CONDITION Available Description/Example
security.noaccessfield= Admin Tests if the currently logged in user has no access to the
{Table.Field} Table.Field.
Example:
~[if.security.noaccessfield=Students.DOB]
No Access
[/if]
security.fieldlevel={Table.Field} Admin Tests if the currently logged in user has no access to the
{Operator}{Access_level} Table.Field based on access level.
Example:
~[if.security.fieldLevel=Students.Dob>NoAccess]
Has view or modify access
[/if]
Available Operators: >=, <=, !=, >, <, =
Available Access_level: NoAccess, ViewOnly, FullAccess
~(gpv.{posted_value_name})
The two do basically the same thing, but are processed by PowerSchool in different ways. You should always
use the round bracket version. (Among other things, the square bracket version does not have all the options
below.)
~(gpv. Admin Returns the posted value from the URL or the
{posted_value_name};encodejsstring) Teachers previous page submit and returns the JavaScript
Guardian encoded result.
Subs URL Request: /admin/home.html?my_gpv=it's
>< alive
GPV Tag: ~(gpv.my_gpv;encodejsstring)
Result: it\'s >< alive
Where to use: When the gpv returned is to be
used in JavaScript string.
~(gpv.{posted_value_name};urlencode) Admin Returns the posted value from the URL or the
Teachers previous page submit and returns the url
Guardian encoded result.
Subs URL Request: /admin/home.html?my_gpv=it's
>< alive
GPV Tag: ~(gpv.my_gpv;urlencode)
Result: it%27s+%3E%3C+alive
Where to use: When the gpv returned is to be
used as part of a link.
Tag Available Description/Example
~(gpv.{posted_value_name};encodehtml) Admin Returns the posted value from the URL or the
Teachers previous page submit and returns the html
Guardian encoded result.
Subs URL Request: /admin/home.html?my_gpv=it's
>< alive
GPV Tag: ~(gpv.my_gpv;encodehtml)
Result: it's >< alive
Where to use: When the gpv returned is
displayed in a webpage.
~(gpv.{posted_value_name};num) Admin Returns the posted numeric value from the URL
Teachers or the previous page submit.
Guardian URL Request: /admin/home.html?my_gpv=it's
Subs >< alive
GPV Tag: ~(gpv.my_gpv;num)
Result: 0
URL Request: /admin/home.html?my_gpv=43
GPV Tag: ~(gpv.my_gpv;num)
Result: 43
Where to use: When the gpv returned is to be
guaranteed or supposed to be a number.
~(gpv.{posted_value_name};sqlText) Admin Returns the posted value from the URL or the
Teachers previous page submit and returns the sql
Guardian encoded result.
Subs URL Request: /admin/home.html?my_gpv=it's
>< alive
GPV Tag: ~(gpv.my_gpv;sqlText)
Result: it''s >< alive
Where to use: When the gpv returned is to be
used in a tlist_sql tag
~(gpv.{posted_value_name};if.blank.then= Admin Returns the posted value from the URL or the
{some_default_value}) Teachers previous page submit and returns a default value
Guardian if the value is blank.
Subs URL Request: /admin/home.html?my_gpv=
GPV Tag: ~(gpv.my_gpv;if.blank.then=-1)
Result: -1
Where to use: When the gpv returned will
possibly be blank
TLIST_SQL
"TLIST_SQL" is the name of a tag that executes SQL right in the page and returns the results. It is STRONGLY
DEPRECATED in new development work for several reasons: if not used carefully it can easily introduce
security holes, reflects improper layering, and because there is almost always a better way to do the same
operation. (See PowerQuery reference.)
The following table is a reference of the modifiers that can be applied to variables in the tlist_sql statement.
Modifier Description/Example
Modifier Description/Example
;d Date - Formats a column that's a DATE or TIMESTAMP type to display in currently logged
in users locale format.
Example:
Tag: ~[tlist_sql;select sysdate from dual]~(sysdate;d)[/tlist_sql]
Output: 2/2/2015
;l;format=time Time - Converts a column that's a NUMBER that represents seconds as HH:MM.
Example
Tag: ~[tlist_sql;select start_time, end_time from bell_schedule_items]~
(start_time;l;format=time) -- ~(end_time;l;format=time)[/tlist_sql]
Output: 9:34 AM -- 10:34 AM
;Js JS will escape specific characters so that the returned value in the TList_SQL can be
injected into a Javascript String value.
As of 8.3 this was modified to perform true JavaScript escaping.
Example
Tag: ~[tlist_sql;select 'Every "High" ''School''' schoolName from dual]~(schoolName;js)
[/tlist_sql]
Output: Every \"High\" \'School\'
;Json (9.0+) Json will escape specific characters so that the returned value in the TList_SQL can be
injected into a JSON object.
Example
Tag: ~[tlist_sql;select 'Every "High" ''School''' schoolName from dual]~(schoolName;json)
[/tlist_sql]
Output: Every \"High\" 'School'
;Html (9.0+) Html will escape specific characters so that the returned value in the TList_SQL can be
rendered to the page while preventing html injection.
Example:
Tag: ~[tlist_sql;select '< >' gtLt from dual]~(gtLt;html)[/tlist_sql]
Output: < >
;Xml10 (9.0+) Xml10 will escape specific characters so that the returned value in the TList_SQL can be
injected into a XML v1.0 object.
Example:
Tag: ~[tlist_sql;select '< > ''' gtLt from dual]~(gtLt;xml10)[/tlist_sql]
Output: < > '
;Xml11 (9.0+) Xml11 will escape specific characters so that the returned value in the TList_SQL can be
injected into a XML v1.1 object.
Example:
Tag: ~[tlist_sql;select '< > ''' gtLt from dual]~(gtLt;xml10)[/tlist_sql]
Output: < > '
Copyright © 2000-2019, PowerSchool Group LLC. All rights reserved. 150 Parkshore Dr, Folsom, CA 95630