iStrip Template Variables

[ Back to top ]

Preamble
The purpose of this document is to provide documentation for the variables available to iStrip template designers. This section also briefly covers the basics of using Smarty's template features. For more detailed information on building templates, see the documentation on template building, and the Smarty homepage.

Template variable format
Template variables are accessed from within templates by enclosing them in a set of delimiters. By default the delimiters are curly braces, {}. To access a variable, you just use the variable name on it's own, for example, {$allowed_html}

Most template variables arranged into groups. To access a member of the group, you use the group name and the member name separated with a dot. For example, {$archive.count_strips}

Indexed array groups
The $striplist group is an indexed array of variables, each index entry representing one of the strips in the archive. To access details on a particular strip, give the index number you want in square braces between the group name and the member you want to access. Due to the way the Smarty template system accesses indexed array elements, the index number of the strip you want is one below the ID number of the strip you want to access. So strip 1 is index 0, strip 2 is index 1 and so on. So to access details on strip one, you would use $striplist[0]. For example, {$striplist[0].strip_title} would return the title of strip number 1

The $themes group is also an indexed array, but each element is a string variable and not an associative array like $striplist. To access a value, use the number of the index you want to access in square braces after the $themes group. For example, $themes[0] will return the name of the first installed theme iStrip finds

It is not intended that you would access these elements like this, instead you are meant to access them using other template variables, or Smarty's array handling functions such as foreach and section. For examples on template functions, see the template building documentation and the documentation on the Smarty website.

Depreciated variables
The column to the right of the variable name lists the name by which the variable in question was accessed under old versions of iStrip. In addition, the section at the end of this page lists a set of template variables that were available in old versions of iStrip but have since been completely removed as their functionality was duplicated elsewhere in the new variable set. This information is included for the benefit of template designers updating templates from old versions of iStrip to the current format.

[ Back to top ]

Variable groups
This is a comprehensive list of all the currently available template variables in iStrip and where they can be accessed from.

[ Back to top ]

$archive
Description Contains information about the strip archive
Availability Global (except admin/report.tpl)
Variable Replaces Description
count_strips number_of_strips A count of the number of strips in the strip index
count_news number_of_news A count of the number of news items in the strip index
size_stripdir_b dirsize_strip_b The amount of space the strip directory is taking up, in bytes, kilobytes and megabytes respectively
size_stripdir_k dirsize_strip_k
size_stripdir_m diesize_strip_m
size_newsdir_b dirsize_news_b The amount of space the news directory is taking up, in bytes, kilobytes and megabytes respectively
size_newsdir_k dirsize_news_k
size_newsdir_m dirsize_news_m
date_strip_first_s strip_date_first_short Date information for the first strip in the strip index
date_strip_first_l strip_date_first_long
days_ago_first - The number of days since the first strip was posted
date_strip_last_s strip_date_curr_short Date information for the last strip in the strip index
date_strip_last_l strip_date_curr_long
days_ago_last - The number of days since the last strip was posted

[ Back to top ]

$banner
Description Contains a randomly selected banner image
Availability All user pages
Variable Replaces Description
file banner_file The full path to the banner image relative to the iStrip root

[ Back to top ]

$cfg
Description Contains information on the current iStrip configuration
Availability admin/cp_configure.tpl
Variable Replaces Description
date_l dateformat_short Contains strings iStrip uses for formatting dates
date_s dateformat_long
debug_timer stopwatch Contains the state of the page generation timer. Contains 1 if it is enabled, contains no value if it is disabled
debug_smarty - Contains the state of the Smarty debug console. Contains 1 if it is enabled, contains no value if it is disabled
dir_banner bannerdir The location relative to the iStrip root where iStrip will look for the banner dir
html_news allowed_html_news The HTML tags iStrip will allowed to be used in news posts
rnd_file round_filesize The number of places iStrip will round _k and _m file sizes to
rnd_timer round_stopwatch The number of places iStrip will round the page generation timer to
smarty_nosub - Weather or not Smarty is using subdirs for template compilation
theme tpldir The currently selected theme

[ Back to top ]

$nav
Description Contains data for navigating around the strip archive
Availability All user pages
Variable Replaces Description
current - Contains the ID of the strip currently being viewed. Equivalent to $strip.id
first lnk_first, lnk_first_end Contains the ID of the first strip in the archive (always 1), or no value if the current strip is already 1
prev lnk_prev, lnk_prev_end Contains the ID of the strip prior to the one being viewed, or no value if the current strip is already 1
next lnk_next, lnk_next_end Contains the ID of the strip that follows the one being viewed, or no value if the current strip is already the last one
last lnk_curr, lnk_curr_end Contains the ID of the last strip in the archive, or no value if the current strip is already the last one
is_first - Contains 1 if the strip currently being viewed is the first one, or no value if it isn't
is_last - Contains 1 if the strip currently being viewed is the last one, or no value if it isn't

[ Back to top ]

$news
Description Contains data on the current strip's news item, or of the most recent prior news item if in search mode
Availability All user pages , admin/cp_manage.tpl, admin/vf_news.tpl, admin/vf_strip.tpl
Variable Replaces Description
date_s news_date_short Date information on the current news item
date_l news_date_long
days_ago - The number of days since the news item was posted
title news_title The title of the current news item
file - The full path to the location of the news item, relative to the iStrip root
file_nopath - The filename of the news item, minus the path information
data news_file The contents of the news file
data_edit - The contents of the news file with certain HTML tags stripped out to make it suitable for editing

[ Back to top ]

$pagination
Description Contains data used to paginate the striplist on the admin index page
Availability admin/index.tpl
Variable Replaces Description
strip_start - The first strip on the current page. Counts from 0 to be compatible with the $striplist array
strip_end - The last strip on the current page. Counts from 0 to be compatible with the $striplist array
page_size - The number of strips currently being displayed
page_count - The number of pages that the striplist can be split into
page_num - The number of the page currently being displayed. Counts from 1
page_is_first - A boolean that is true if page 1 is being displayed
page_first - Contains the number of the first page (1) if not on the first page, is empty otherwise
page_prev - Contains the number of hte page that precedes the current one unless the current page is 1
page_is_last - A boolean that is true if the last page is being displayed
page_next - Contains the number of the last page if the last page isn't currently being viewed
page_last - Contains the number of the page that follows the current one unless the current page is the last one
html - Page numbers with links to the available pages, with the exception of the page being currently displayed

[ Back to top ]

$report
Description Holds the results of operations performed by various admin scripts
Availability admin/report.tpl
Variable Replaces Description
op operation A brief text description of the requested action
log report A list of the operations iStrip performed and their results

[ Back to top ]

$server
Description Contains information on the iStrip host environment
Availability Global (except admin/report.tpl)
Variable Replaces Description
sw env_server_sw Details about the PHP version being used and some additional info
dns env_server_dns The DNS hostname of the server iStrip is running on (Example: localhost)
ip env_server_ip The IP address of the server iStrip is running on (Example: 127.0.0.1)
port env_server_port The port HTTP requests are being handled through (usually 80)
os env_server_os The operating system of the host computer

[ Back to top ]

$strip
Description Information on the current strip
Availability All user pages , admin/cp_manage.tpl, admin/vf_news.tpl, admin/vf_strip.tpl
Variable Replaces Description
id strip_id The ID of the current strip
date_s strip_date_short Date the current strip was posted on
date_l strip_date_long
days_ago - Number of days since the current strip was posted
title strip_title Strip title
file strip_file Full path to the strip file, relative to the iStrip root
file_nopath - The filename of the strip file, minus the path information
width strip_width Strip dimensions
height strip_height

[ Back to top ]

$striplist (array)
Description Each array index holds another array containing data on a given strip in the archive. In the following variable list, the variable name refers to a key in the embedded array. The array replaces the cp_list_fwd, cp_list_rev, ar_list_fwd and ar_list_rev template vars. The array can be traversed with Smarty's looping functions and offers greater flexibility than the template vars it replaces
Availability Global (except admin/report.tpl)
Variable Replaces Description
id - The number of the strip referenced by this entry
strip_date_s - Date information on the strip
strip_date_l -
days_ago - Days since the strip was uploaded
strip_file - The full path to the strip file, relative to the iStrip root
strip_file_nopath - The filename of the strip file, minus the path information
strip_width - Strip dimensions
strip_height -
strip_title - Strip title
news_pres - Contains 1 if there is a news item associated with this strip, contains no value otherwise
news_title - News item title
news_file - The full path to the news item, relative to the iStrip root
news_file_nopath - The filename of the news item, minus the path information

[ Back to top ]

$themes (array)
Description Contains a list of themes installed in the template dir. Normally only used to generate a theme list for a <select> object
Availability admin/cp_configure.tpl
Variable Replaces Description
(Index of element) - Contains the name of one of the themes in the template dir

[ Back to top ]

$yearblocks (array)
Description Contains data that can be used to split the $striplist array by year. Each element of the array covers all the strips for one year
Availability All user pages
Variable Replaces Description
year - The year covered by this element
start - The number of the first strip that was uploaded in the year covered by this element. Counts from 0 to be compatible with the $striplist array
end - The number of the last strip that was uploaded in the year covered by this element. Counts from 0 to be compatible with the $striplist array
count - The number of strips uploaded during the year covered by this element

[ Back to top ]

Miscellaneous
Description Variables that don't exist within a particular group.
Availability Varies - See description field
Variable Replaces Description
$SCRIPT_NAME - The full path of the script currently being executed. Availability: Global
$allowed_html allowed_html HTML allowed in news posts. Availability: cp_manage, cp_configure
$view - Contains the name of the current template being viewed. Availability: All user pages

[ Back to top ]

Depreciated
Description These are variables that are no longer supported by iStrip. Their functionality can be replicated with a combination of other template variables and features of the Smarty template engine
Availability Nowhere!

[ Back to top ]

As of iStrip 1.3.1
Description These are variables that are no longer supported by iStrip. Their functionality can be replicated with a combination of other template variables and features of the Smarty template engine
Availability Nowhere!
Variable Notes
$cfg.dir_news These values are now changed by editing the istrip_constants.php file. See the documentation on advanced configuration
$cfg.dir_strip
$cfg.file_index
$cfg.strip_chmod
$cfg.strip_chmod_val
$cfg.tag_close
$cfg.tag_open

[ Back to top ]

As of iStrip 1.2.0
Description These are variables that are no longer supported by iStrip. Their functionality can be replicated with a combination of other template variables and features of the Smarty template engine
Availability Nowhere!
Variable Notes
list_cp_fwd The $striplist array can be used to replicate these lists and is far more powerful and flexible
list_cp_rev
list_ar_fwd
list_ar_rev
img_first This functionality can be reproduced with the Smarty if...else.../if block and the $nav vars for checking whether the user is currently viewing the first or last strip

Example:

{if $nav.is_first}
   <img src="images/nav/nav_first_inactive.gif" />
{else}
   <img src="images/nav/nav_first_active.giff" />
{/if}
img_prev
img_next
img_curr
cn_img_active_first
cn_img_active_prev
cn_img_active_next
cn_img_active_curr
cn_img_inactive_first
cn_img_inactive_prev
cn_img_inactive_next
cn_img_inactive_curr
no_title_strip Default strings can be set using Smarty's default function

Example: {$strip.title|default:'No title'}
no_title_news
news_none
date_none

[ Back to top ]

Copyright © 2002, 2003 Gordon McVey