XT Object Reference
As I mentioned previously in the article, and as you've seen throughout
the examples, XT templates refer to data objects in every tag
substitution. These objects provide you with access to data and
information from and
about the Sitellite environment, including the current page data,
current visitor request, and the web site itself. The following
is a list of these objects and the data properties that they contain,
so that you may better understand them when designing your templates.
| Tag | Description |
|---|
| object/id | This is the ID value of the current page. Please note that "page" is
an alias of "object" for this and all of the values in this list. |
object/below_page
| The name of the parent page, if any.
|
object/title
| The title of the current page.
|
object/description
| A description of the current page, for use in the description meta tag.
|
object/keywords
| A comma-separated list of keywords associated with the current page, for use in the keywords meta tag.
|
object/body
| The body of the current page.
|
object/makeMeta
| A function that renders all of the meta tags associated with this page, so that you don't have to create them individually.
|
object/makeJavascript
| A
function that renders all of the javascript scripts associated with
this page, so that you don't have to code them into the template
explicitly.
|
object/toc
| A bulleted list of headings within the page body. This allows you to display extra navigation within longer pages.
|
object/onload, onunload, onfocus, onblur, onclick
| These
contain event handlers for each of the events that are associated with
the page itself. They should be inserted into the page
<body> tag as attributes, like this: <body
onload="${onload}">.
|
cgi/var1, cgi/var2, etc.
| This
is the way in which you can refer to parameters passed to the current
page request, either via the URL (ie. ?var1=...&var2=...), or via a
POST request (ie. form data).
|
cookie/var1, etc.
|
This is the way in which you can refer to session cookie values.
|
conf/Site/secure
| This is the way in which you can refer to the values found in your Sitellite configuration file (ie. inc/conf/config.ini.php).
|
site/domain
| The domain of the web site (ie. www.yourWebSite.com).
|
site/prefix
| The
prefix URL if your site is installed into a subdirectory (ie. /subdir),
or empty otherwise. This value is handy to add to templates for
the sake of portability (ie. <img
src="${site/prefix}/inc/html/mydesign/pix/logo.gif" />).
|
site/url
| The URL of your Sitellite installation, including protocol and webpath (ie. http://www.yourWebSite.com/install_dir).
|
site/current
| The current page request, minus parameters and anchors (ie. for /index/news-app?story=522#top it would be /index/news-app).
|
site/webpath
| The path from the root of your web site to your site (ie. /, or /subdir if you've installed into a subdirectory).
|
site/abspath
| The absolute path to the web site (ie. /home/yourWebSite/public_html).
|
site/adminpath
| The web path to Sitellite's admin UI (ie. /sitellite).
|
site/secure
| Whether or not the web site is behind SSL.
|
session/username
| The username of the current visitor, if they are logged in.
|
session/valid
| Whether the user is logged in.
|
session/admin
| Whether the user is logged in and is an administrative user.
|
php: session_role ()
| The role of the user.
|
php: session_team ()
| The team of the user.
|
php: session_allowed ('resource_name', 'rw')
| This
is how you can verify whether a user is allowed to access the specified
resource with the permission level you specify (rw = read and
write). Resources correspond to the resources defined in
inc/conf/auth/resources/index.php (which you should always edit via the
Sitellite Control Panel -- NOT by hand).
|
loop/item
| This is
a context-sensitive construct created by the XT looping
functions. There are others, which are documented in the SAF
documentation, but for this reference (ie. for the essentials) it will
suffice to mention only this one.
|
For more information about XT, please refer to the Sitellite Application Framework (SAF) documentation available at
http://www.sitellite.org/docs/
Stay tuned for my next articles about SimpleTemplate, writing custom apps, and more, coming very soon to sitellite.org.
Page 1: Introduction
Page 2: First Steps
Page 3: Substitutions (Part 2)
Page 4: Conditions
Page 5: Loops
Page 6: Includes
Page 7: Boxes
Page 8: I18n
Page 9: XT Object Reference
All Tutorials