![]() |
Geeklog Documentation - Variables in Themes |
Note: This is not a complete documentation of the theme variables - it only covers variables that can be used in the site header and in story templates.
Geeklog uses the template engine of the PHP
Base Library (also known as PHPlib). This library allows the use of
so-called variables in the template files. A variable is a word enclosed in
curly brackets, like this: {variable}
. When Geeklog creates a web
page it will replace the variables in the template files with certain values.
A variable can hold static text (i.e. it will alway be replaced with the same
text), dynamic content (e.g. the number of comments to a story or the entire
text of a story), or even the content of another template file (used for lists,
for example).
Please note that not all variables are available in all template files.
While the variable {site_url}
(which holds the URL of your Geeklog
site) is available in most template files, many variables are only available
in one template file (e.g. the variable {formatted_article}
is only
available in the article.thtml template file). Geeklog will remove any
variables which are not defined for the current template file (i.e. they will
be replaced with an empty string). No error or warning messages will be
created when you use an undefined variable.
The following variables are available in the site header, i.e. in the header.thtml template file:
Variable | Example | Description |
---|---|---|
site_url |
http://www.example.com | The URL of your Geeklog site (the exact same URL you specified in
$_CONF['site_url'] in your config.php
file). |
layout_url |
http://www.example.com/layout/XSilver | The URL of the layout folder of the user's current theme. |
page_title |
Geeklog Site - Another Nifty Geeklog Site | Holds either the site's name and slogan or the site name and the title of the current story. |
background_image |
http://www.example.com/layout/ XSilver/images/bg.gif |
Points to a file named bg.gif in the images folder of the current theme, intended to be used as a background image. |
site_mail |
admin@example.com | Email address where people can contact the site's administrator. Because of the spam problem, it is recommended you don't actually use this on your site and provide a link to the Admin's email submission form instead: {site_url}/profiles.php?uid=2 (where "2" is the user id of the person who will receive the email, usually the Admin user. |
site_name |
Geeklog Site | The name of your Geeklog site. |
site_slogan |
Another Nifty Geeklog Site | The slogan of your site. |
welcome_msg |
Welcome to Geeklog Site | A welcome message, followed by the user's name (for registered users). |
datetime |
Thursday, November 28 2002 @ 11:43 AM PST | The current date and time, formatted according to
$_CONF['date'] . |
site_logo |
http://www.example.com/layout/ XSilver/images/logo.gif |
Points to a file named logo.gif in the images directory of the current theme, intended to be used as the site's logo. |
css_url |
http://www.example.com/layout/ XSilver/style.css |
Points to the style sheet of the current theme. |
theme |
XSilver | Name of the current theme. |
charset |
iso-8859-1 | The character set for the current language file. |
rss_url |
http://www.example.com/backend/geeklog.rdf | The URL of your site's RSS feed (identical to {rdf_file} .
This variable is also available in the site's
footer.thtml. |
rdf_file |
http://www.example.com/backend/geeklog.rdf | The URL of your site's RSS feed (identical to {rss_url} .
This variable is also available in the site's
footer.thtml. |
The following variables are available in the storytext.thtml,
storybodytext.thtml, featuredstorytext.thtml, and
featuredstorybodytext.thtml template files. These files are used to
render stories for the index page as well as the content of the
{formatted_article}
variable in the article/article.thtml
file (which is used to display a story on its own page).
Variable | Example | Description |
---|---|---|
site_url |
http://www.example.com | The URL of your Geeklog site (the exact same URL you specified in
$_CONF['site_url'] in your config.php
file). |
layout_url |
http://www.example.com/layout/XSilver | The URL of the layout folder of the user's current theme. |
story_date |
Tuesday, October 22 2002 @ 11:50 PM PDT | The date and time of the story, formatted according to the user's preferred date and time format. |
lang_views |
Views | The word "Views" in the user's preferred language. |
story_hits |
42 | Number of times the story was read. |
article_url |
http://www.geeklog.net/article.php?story=20021022234959146 | The full URL to the story on its own page (article.php). This will also reflect the correct URL when URL rewriting is activated. |
story_id |
20021022234959146 | The ID of a story (can be used to build URLs, e.g. for a "link to this story" link). |
story_title |
Welcome to Geeklog! | The title of the story. |
story_introtext |
Welcome and let me be the first to congratulate you on installing GeekLog ... | When displayed on the index page, this variable contains The "intro text" part of a story. However, when displayed as an article on a single page, it contains both the intro text and the body text of the story. |
lang_todays_featured_article |
Today's Featured Article | The words "Today's Featured Article" in the user's preferred language. Only available when the story is the featured story. |
The following variables are only available when the story is displayed on the index page and the body text of the story is not empty:
Variable | Example | Description |
---|---|---|
lang_readmore |
read more | The words "read more" in the user's preferred language. |
lang_readmore_words |
words | The word "words" in the user's preferred language. |
readmore_words |
62 | The number of words in the body text of the story. |
readmore_link |
<a href="...">read more</a> (62 words) |
Link to the story on a separate page, including the number of word in the body text. |
start_readmore_anchortag |
<a href=".../article.php |
Opening tag for a link to the story on a separate page. |
end_readmore_anchortag |
</a> |
Closing tag for a link to the story. |
email_icon |
(icon) | The email icon, linking to the form to send the story by email. |
print_icon |
(icon) | The printer icon, linking to a "printer friendly" version of the story. |
recent_post_anchortag |
-- | When no comments have been posted yet, this variable contains just a
link to the comment submission form (just like
{post_comment_link} ). When there are comments to the story,
then this variable does not contain a link but instead
contains the user name of the person who posted the last comment as well
as the date and time when that comment was posted. |
The following variables are only available when comments on a story are enabled and when comments have been made to the story already:
Variable | Example | Description |
---|---|---|
comments_url |
http://www.example.com/article.php ?story=20021022234959146#comments |
URL of the comments section (when a story is displayed on a separate page). |
comments_text |
2 comments | The number of comments, followed by the word "comments" in the user's preferred language. |
comments_count |
2 | The number of comments to the story (will always be 1 or greater). |
lang_comments |
comments | The word "comments" in the user's preferred language. |
start_comments_anchortag |
<a href=".../article.php |
Opening tag for a link to the comments section of a story. |
end_comments_anchortag |
</a> |
Closing tag for a link to the comments section of a story. |
post_comment_link |
<a href=".../comment.php |
Link to the comment submission form (using "Post a comment" in the user's preferred language as the link text). |
The following variables are only available when
$_CONF['contributedbyline'] = 1;
in your config.php, i.e.
when you allow the name of the story's author to be displayed:
Variable | Example | Description |
---|---|---|
lang_contributed_by |
Contributed by: | The text "Contributed by:" in the user's preferred language. |
contributedby_uid |
7 | The user id of the story's author. |
contributedby_user |
Tony | The user name (short name) of the story's author. |
contributedby_fullname |
Tony Bibbs | The full name of the story's author. If the user hasn't filled in his/her full name, the user name is used instead. |
start_contributedby_anchortag |
<a class="storybyline" href="http://www.example.com/ |
Opening tag for a link to the story author's profile (empty for anonymous authors). |
end_contributedby_anchortag |
</a> |
Closing tag for a link to the story author's profile (empty for anonymous authors). |
contributedby_url |
http://www.example.com/ users.php?mode=profile&uid=7 |
Link to the story author's profile (empty for anonymous authors). |
contributedby_photo |
<img src=".../images/userphotos/Tony.gif" alt="Tony Bibbs"> | User photo of the story author, if provided (always empty for anonymous authors). |
The following variables are only available if topic icons are enabled for the story and the user has not disabled topic icons in his/her display preferences:
Variable | Example | Description |
---|---|---|
story_anchortag_and_image |
<a href="http://www.example.com/ (shortened) |
Topic icon for the story's topic, enclosed in a link to the site's index page, sorted by topic. |
story_topic_image |
<img align="right" src="http://www.example.com/ |
Topic icon for the story. |
story_topic_id |
General | Id (internal name) of the topic, e.g. to be used in links. |
story_topic_name |
General News | Topic name (as seen on the Sections block). |
story_topic_url |
<a href="http://www.example.com/ |
URL to your site's index page, so that only stories with the story's topic are displayed. |
The following variables are only available when the current user has the permissions to edit a story:
Variable | Example | Description |
---|---|---|
edit_link |
<a href=".../admin/story.php |
Link to open the story in the admin's story editor. |
edit_icon |
<a href=".../admin/story.php |
An icon linking to the admin's story editor to edit the story. |
edit_url |
http://www.example.com/admin/story.php ?mode=edit&sid=20021022234959146 |
URL to open the story in the admin's story editor |
lang_edit_text |
edit | The word "edit" in the user's preferred language. |
The Geeklog Documentation Project All trademarks and copyrights on this page are owned by their respective owners. GeekLog is copyleft. |