Retired Documentation: You are using the documentation for version 1.7.3 which was retired in 2013. Go here for the latest version documentation or check here for your available upgrades to the latest version.
Weblog Entries - Single Variables
The standard {exp:weblog:entries} tag has a multitude of variables that can be used inside of it. These variables have been split into two broad categories:
Standard Variables
- {absolute_count}
- {aol_im}
- {author}
- {author_id}
- {avatar_image_height}
- {avatar_image_width}
- {avatar_url}
- {bio}
- {comment_auto_path}
- {comment_entry_id_auto_path}
- {comment_tb_total}
- {comment_total}
- {comment_url_title_auto_path}
- {count}
- {email}
- {entry_id}
- {entry_id_path='weblog/archives'}
- {entry_site_id}
- {forum_topic_id}
- {icq}
- {interests}
- {ip_address}
- {location}
- {member_search_path='search/results'}
- {msn_im}
- {occupation}
- {page_uri}
- {page_url}
- {permalink=weblog/archives}
- {photo_url}
- {photo_image_height}
- {photo_image_width}
- {profile_path='member'}
- {relative_date}
- {relative_url}
- {screen_name}
- {signature}
- {signature_image_height}
- {signature_image_url}
- {signature_image_width}
- {status}
- {switch='option_one|option_two|option_three'}
- {title}
- {title_permalink=weblog/archives}
- {total_results}
- {trackback_total}
- {trimmed_url}
- {url}
- {url_or_email}
- {url_or_email_as_author}
- {url_or_email_as_link}
- {url_title}
- {url_title_path='weblog/archives'}
- {username}
- {weblog}
- {weblog_id}
- {weblog_short_name}
- {yahoo_im}
- Custom Entry Fields
- Custom Member Fields
absolute_count
{absolute_count}
The absolute "count" out of the current entries being displayed by the tag, including those entries on previous pages (if using pagination).
If five entries are being displayed per page, then for the fourth entry on the second page the {absolute_count} variable would have a value of "9"
BONUS: Since the Search module utilizes weblog variables, {absolute_count} is also available to the Search Results tag.
aol_im
{aol_im}
The author's AOL IM account name
author
{author}
The author's screen name, if it exists; otherwise, this variable will display the username.
author_id
{author_id}
The member ID number of the author
avatar_image_height
{avatar_image_height}
The height of the avatar image associated with the entry's author. Typically used as such:
{if avatar}
<img src="{avatar_url}" width="{avatar_image_width}" height="{avatar_image_height}" alt="{author}'s avatar" />
{/if}
avatar_image_width
{avatar_image_width}
The width of the avatar image associated with the entry's author. Typically used as such:
{if avatar}
<img src="{avatar_url}" width="{avatar_image_width}" height="{avatar_image_height}" alt="{author}'s avatar" />
{/if}
avatar_url
{avatar_url}
The URL to the avatar image associated with the entry's author. Typically used as such:
{if avatar}
<img src="{avatar_url}" width="{avatar_image_width}" height="{avatar_image_height}" alt="{author}'s avatar" />
{/if}
bio
{bio}
The author's bio as entered in their profile.
comment_auto_path
{comment_auto_path}
This variable is replaced by the URL set in the "Comment Page URL" preference under Admin > Weblog Management. No entry id, URL Title, or other information is included; this is the exact URL from the preference.
comment_entry_id_auto_path
{comment_entry_id_auto_path}
This variable is replaced by the URL set in the "Comment Page URL" preference under Admin > Weblog Management. The ID number of the entry will be automatically added. For example, this:
<a href="{comment_entry_id_auto_path}">my entry</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/comments/234/">my entry</a>
comment_tb_total
{comment_tb_total}
The combined total number of both comments and trackbacks for a particular entry
comment_total
{comment_total}
The total number of comments for a particular entry
comment_url_title_auto_path
{comment_url_title_auto_path}
This variable is replaced by the URL set in the "Comment Page URL" preference under Admin > Weblog Management. The URL Title of the entry will be automatically added. For example, this:
<a href="{comment_url_title_auto_path}">my entry</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/comments/ice_cream/">my entry</a>
count
{count}
The "count" out of the current entries being displayed. If five entries are being displayed, then for the fourth entry the {count} variable would have a value of "4".
{email}
The author's raw email address
entry_id
{entry_id}
The ID number of the weblog entry
entry_id_path
{entry_id_path='weblog/archives'}
The URL to the specified template. The ID number of the entry will be automatically added. For example, this:
<a href="{entry_id_path='weblog/archives'}">my entry</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/archives/234/">my entry</a>
entry_site_id
{entry_site_id}
The Site ID of the weblog entry.
forum_topic_id
{forum_topic_id}
If you have the Discussion Forum Module installed and if you have associated a forum thread with a weblog entry (via the "Forum" section of the Publish tab), this is the ID number of the forum thread. It will typically be used like so:
{if forum_topic}
<a href="{path='forums/viewthread'}{forum_topic_id}">Discuss this in our forums</a>
{/if}
icq
{icq}
The author's ICQ IM user identification number
interests
{interests}
The author's "interests" as entered in their profile
ip_address
{ip_address}
The IP address of the author when they posted the entry
location
{location}
The author's location as entered in their profile
member_search_path
{member_search_path='search/results'}
This variable is replaced by a URL that passes the author's member name to your search results Template. In this way, you can display all entries made by the author. You should specify the Template_Group/Template that you use to display search results. For example:
<a href="{member_search_path='search/results'}">View entries by this member</a>
msn_im
{msn_im}
The author's MSN IM account name
occupation
{occupation}
The author's occupation as entered in their profile
page_uri
{page_uri}
If you have the Pages Module installed and if you have associated a static page with a weblog entry (via the "Pages" section of the Publish tab), this is the page uri for the page. It will typically be used like so:
{if page_uri != ''}
<a href="{page_uri}">View this page</a>
{/if}
page_url
{page_url}
If you have the Pages Module installed and if you have associated a static page with a weblog entry (via the "Pages" section of the Publish tab), this is the page url for the page (the site URL + the page URI). It will typically be used like so:
{if page_url != ''}
<a href="{page_url}">View this page</a>
{/if}
permalink
{permalink}
This variable defaults to site index with entry ID number:
http://example.com/235/
In addition, you can specify a template group/template and the entry ID will automatically be added:
{permalink="weblog/archives"}
Will render as:
http://example.com/weblog/archives/235/
photo_url
{photo_url}
This variable supplies the URL to the member photo (if you have that option enabled and the member has uploaded their photo). It is intended for use in an image tag.
photo_image_height
{photo_image_height}
This variable supplies the height of the member photo. It is intended for use in an image tag.
photo_image_width
{photo_image_width}
This variable supplies the width of the member photo. It is intended for use in an image tag.
profile_path
{profile_path='member'}
The URL to the author of the current entry. The ID number of the author will be automatically added. Used in a link:
<a href="{profile_path='member'}">{author}</a>
relative_url
{relative_url}
The URL stored in your Weblog URL setting under Weblog Management, with the domain information removed. For example, if your setting is http://example.com/index.php/site/index/ the variable will output /index.php/site/index/. Typically only used in the Atom feed Template.
relative_date
{relative_date}
The amount of time that has passed between when the entry was submitted and the current time. The output is displayed in the format 1 day, 3 hours, 45 minutes. This variable is useful for displaying something such as "This entry was posted 1 day, 3 hours, 45 minutes ago."
screen_name
{screen_name}
The author's screen name, if it exists. This variable will not return anything if the author does not have a screen name defined.
signature
{signature}
The signature associated with the entry's author. Typically used as such:
{if signature}
<p>{signature}</p>
{/if}
signature_image_height
{signature_image_height}
The height of the signature image associated with the entry's author. Typically used as such:
{if signature_image}
<img src="{signature_image_url}" width="{signature_image_width}" height="{signature_image_height}" alt="{author}'s signature" />
{/if}
signature_image_url
{signature_image_url}
The URL to the signature image associated with the entry's author. Typically used as such:
{if signature_image}
<img src="{signature_image_url}" width="{signature_image_width}" height="{signature_image_height}" alt="{author}'s signature" />
{/if}
signature_image_width
{signature_image_width}
The width of the signature image associated with the entry's author. Typically used as such:
{if signature_image}
<img src="{signature_image_url}" width="{signature_image_width}" height="{signature_image_height}" alt="{author}'s signature" />
{/if}
status
{status}
The status of the entry (open, closed, etc.)
switch=
{switch='option_one|option_two|option_three'}
This variable permits you to rotate through any number of values as the entries are displayed. The first entry will use "option_one", the second will use "option_two", the third "option_three", the fourth "option_one", and so on.
The most straightforward use for this would be to alternate colors. It could be used like so:
{exp:weblog:entries weblog="yourweblog"}
<div class="{switch='one|two'}">
<h1>{title}</h1>
{body}
</div>
{/exp:weblog:entries}
The entries would then alternate between <div class="one"> and <div class="two">.
Multiple instances of the {switch=} tag may be used and the system will intelligently keep track of each one.
title
{title}
The title of the entry
title_permalink
{title_permalink}
This variable uses the "url title" as the link. It defaults to the site index with the "url title":
http://example.com/my_ugly_boyfriend/
In addition, you can specify a specific template group/template and the "url title" will automatically be added:
{title_permalink="weblog/archives"}
Will render as:
http://example.com/weblog/archives/my_ugly_boyfriend/
Note: When creating a new entry, if you don't supply the "url title" then it will be automatically created from the actual entry title. Spaces are turned into underscores and quotes are removed. For example, "Joe's night out" becomes "joes_night_out".
total_results
{total_results}
The total number of entries being displayed.
trackback_total
{trackback_total}
The total number of trackbacks for a particular entry
trimmed_url
{trimmed_url}
The domain name for your site, trimmed of any subdomains. For instance, example.com becomes example.com. Typically only used in the Atom feed Template.
url
{url}
The author's raw URL, if it exists
url_or_email
{url_or_email}
The author's URL if it exists, otherwise the raw email address
url_or_email_as_author
{url_or_email_as_author}
A hyperlink to the author's URL if it exists, otherwise it will be an email link for the author's email address. The text of the link will be the author's screenname if it exists, otherwise it will be the username.
url_or_email_as_link
{url_or_email_as_link}
This is similar to the above variable. The difference is that the text for the link will be either the URL or the email address.
url_title
{url_title}
The human readable title used in the URL as a permalink
url_title_path
{url_title_path='weblog/archives'}
The URL to the specified template. The "url title" of the entry will be automatically added. For example, this:
<a href="{url_title_path='weblog/archives'}">permalink</a>
Would be rendered like this:
<a href="http://example.com/index.php/weblog/archives/ice_cream/">permalink</a>
username
{username}
The author's username
weblog
{weblog}
The name of the weblog that the currently displayed entry is assigned to.
weblog_id
{weblog_id}
The ID number of the actual weblog (not the entry)
weblog_short_name
{weblog_short_name}
The short name of the weblog of the currently displayed entry.
yahoo_im
{yahoo_im}
The author's Yahoo IM account name
Custom Entry Fields
All custom fields assigned to a weblog can be accessed using the "short name" of the field:
{body}
{summary}
{extended}
etc..
These are totally dynamic in that any field you create for your weblog will automatically be available by its "short name" as a variable.
Custom Member Fields
All custom member profile fields can be accessed using the "short name" of the field:
{age}
{gender}
{zodiac}
etc..
These are totally dynamic in that any profile field you create for your members will automatically be available by its "short name" as a variable.
Date Variables
Several date variables are available for use. As with other date variables, these require the "format" parameter in order to define how the date should be displayed. See the date variable formatting page for more information.
- {entry_date format="%Y %m %d"}
- {expiration_date format="%Y %m %d"}
- {edit_date format="%Y %m %d"}
- {gmt_entry_date format="%Y %m %d"}
- {gmt_edit_date format="%Y %m %d"}
- {recent_comment_date format="%Y %m %d"}
- {week_date format="%Y %m %d"}
- Custom Date Fields
entry_date
{entry_date format="%Y %m %d"}
The date the entry was submitted
expiration_date
{expiration_date format="%Y %m %d"}
The expiration date of the entry
edit_date
{edit_date format="%Y %m %d"}
The date on which the entry was last edited
gmt_entry_date
{gmt_entry_date format="%Y %m %d"}
The date the entry was submitted in GMT. This variable is not localized for each user's date settings.
gmt_edit_date
{gmt_edit_date format="%Y %m %d"}
The date on which the entry was last edited in GMT. This variable is not localized for each user's date settings.
recent_comment_date
{recent_comment_date format="%Y %m %d"}
The date of the most recent comment associated with the entry
week_date
{week_date format="%Y %m %d"}
The date that the week of the currently displayed entry started on, most commonly used in "weekly" date headings.
This variable is affected by the start_day parameter. By default, the week date will fall on Sunday for the week of the entry. When start_day="Monday" is used, the week date will fall on Monday for the week of the entry.
Custom Field Dates
Custom weblog fields can be assigned as "date types". Custom fields are managed in your control panel at:
Admin > Weblog Administration > Custom Weblog Fields
Any field that is a date type can be formatted just like other dates. Simply use the name of the custom field at the beginning of the tag. For example, if your custom field is named my_date, you'll format it like this:
{my_date format="%Y %m %d"}