Drupal 6 Phptemplate Theming Cheat Sheet

ADVERTISEMENT

DRUPAL
DRUPAL 6
PHPTEMPLATE THEMING CHEAT SHEET
CHEAT SHEET
Page.tpl.php Variables
Node.tpl.php Variables
General utility variables
Available variables
$base_path
The base URL path of the Drupal installation.
base URL path of the Drupal installation.
$title
the (sanitized) title of the node.
the (sanitized) title of the node.
At the very least, this will always default to /.
At the very least, this will always default to /.
$content
Node body or teaser depending on $teaser flag.
Node body or teaser depending on $teaser flag.
$css
An array of CSS files for the current page.
An array of CSS files for the current page.
$picture
The authors picture of the node output from
The authors picture of the node output from
$directory
The directory the theme is located in, e.g.
The directory the theme is located in, e.g.
theme_user_picture().
theme_user_picture().
themes/garland or themes/garland/minelli.
themes/garland or themes/garland/minelli.
$date
Formatted creation date (use $created to
Formatted creation date (use $created to
$is_front
TRUE if the current page is the front page.
TRUE if the current page is the front page.
reformat with
reformat with format_date()).
Used to toggle the mission statement.
Used to toggle the mission statement.
$links
Themed links like "Read more", "Add new
Themed links like "Read more", "Add new
$logged_in
TRUE if the user is registered and signed in.
TRUE if the user is registered and signed in.
comment", etc. output from
comment", etc. output from theme_links().
$is_admin
TRUE if the user has permission to access
TRUE if the user has permission to access
$name
Themed username of node author output from
Themed username of node author output from
administration pages.
theme_user().
theme_user().
Page metadata
$node_url
Direct url of the current node.
Direct url of the current node.
$language
(object) The language the site is being
(object) The language the site is being
$terms
the themed list of taxonomy term links output
the themed list of taxonomy term links output
displayed in. $language->language contains
>language contains
from theme_links
theme_links().
its textual representation. $language
its textual representation. $language->dir
$submitted
themed submission information output from
themed submission information output from
contains the language direction.
contains the language direction. It will either
theme_node_submitted
theme_node_submitted().
be 'ltr' or 'rtl'.
Other variables
$head_title
A modified version of the page title, for use i
A modified version of the page title, for use in
$node
Full node object. Contains data that may not be
Full node object. Contains data that may not be
the TITLE tag.
safe.
$head
Markup for the HEAD section (including meta
Markup for the HEAD section (including meta
$type
Node type, i.e. story, page, blog, etc.
Node type, i.e. story, page, blog, etc.
tags, keyword tags, and so on).
tags, keyword tags, and so on).
$comment_count
Number of comments attached to the node.
Number of comments attached to the node.
$styles
Style tags necessary to import all CSS files for
Style tags necessary to import all CSS files for
$uid
User ID of the node author.
User ID of the node author.
the page.
$created
Time the node was published formatted in Unix
Time the node was published formatted in Unix
$scripts
Script tags necessary to load the JavaScript
Script tags necessary to load the JavaScript
timestamp.
timestamp.
files and settings for the page.
page.
$zebra
Outputs either "even" or "odd". Useful fo
Outputs either "even" or "odd". Useful for zebra
$body_classes
A set of CSS classes for the BODY tag. This
A set of CSS classes for the BODY tag. This
striping in teaser listings.
striping in teaser listings.
contains flags indicating the current layout
contains flags indicating the current layout
$id
Position of the node. Increments each time it's
Position of the node. Increments each time it's
(multiple columns, single column), the current
(multiple columns, single column), the current
output.
path, whether the user is logged in, and so
path, whether the user is logged in, and so
Node status variables
on.
$teaser
Flag for the teaser state.
Flag for the teaser state.
Site identity
$page
Flag for the full page state.
Flag for the full page state.
$front_page
The URL of the front page. Use this instead of
The URL of the front page. Use this instead of
$promote
Flag for front page promotion state.
Flag for front page promotion state.
$base_path, when linking to the front page.
$base_path, when linking to the front page.
$sticky
Flags for sticky post setting.
Flags for sticky post setting.
This includes the language domain or prefix.
This includes the language domain or prefix.
$status
Flag for published status.
Flag for published status.
$logo
The path to the logo image, as defined in
The path to the logo image, as defined in
$comment
State of comment settings for the node.
State of comment settings for the node.
theme configuration.
$readmore
Flags true if the teaser content of the node
Flags true if the teaser content of the node
$site_name
The name of the site, empty when display has
The name of the site, empty when display has
cannot hold the main body content.
cannot hold the main body content.
been disabled in theme settings.
been disabled in theme settings.
$is_front
Flags true when presented in the front page.
Flags true when presented in the front page.
$site_slogan
The slogan of the site, empty when display
The slogan of the site, empty when display
$logged_in
Flags true when the current user is a logged
Flags true when the current user is a logged-in
has been disabled in theme settings.
has been disabled in theme settings.
member.
member.
$mission
The text of the site mission, empty when
The text of the site mission, empty when
$is_admin
Flags true when the current user is an
Flags true when the current user is an
display has been disabled in
display has been disabled in theme settings.
administrator.
administrator.
Navigation
$search_box
HTML to display the search box, empty if
HTML to display the search box, empty if
Comment.tpl.php Variables
Comment.tpl.php Variables
search has been disabled.
search has been disabled.
nt/comment.tp
$primary_links
An array containing primary navigation links
An array containing primary navigation links
l.php/6
(array)
for the site, if they have been configured.
for the site, if they have been configured.
Available variables
$secondary_links
An array containing secondary navigation links
An array containing secondary navigation links
$author
Comment author. Can be link or plain text.
Comment author. Can be link or plain text.
(array)
for the site, if they have been configured.
for the site, if they have been configured.
$content
Body of the post.
Body of the post.
Page content (in order of occurrence in the default
Page content (in order of occurrence in the default
$date
Date and time of posting.
Date and time of posting.
page.tpl.php)
$links
Various operational links.
Various operational links.
$left
The HTML for the left sidebar.
The HTML for the left sidebar.
$new
New comment marker.
New comment marker.
$breadcrumb
The breadcrumb trail for the current page.
The breadcrumb trail for the current page.
$picture
Authors picture.
Authors picture.
$title
The page title, for use in the actual HTML
The page title, for use in the actual HTML
$signature
Authors signature.
Authors signature.
content.
$status
Comment status. Possible values are
Comment status. Possible values are
$help
Dynamic help text, mostly for admin pages.
Dynamic help text, mostly for admin pages.
comment-unpublished, comment-published or
comment
$messages
HTML for status and error messages. Should
HTML for status and error messages. Should
comment-preview.
comment
be displayed prominently.
be displayed prominently.
$submitted
By line with date and time.
By line with date and time.
$tabs
Tabs linking to any sub-pages beneath the
pages beneath the
$title
Linked title.
Linked title.
current page (e.g., the view and edit tabs
current page (e.g., the view and edit tabs
These two variables are provided for context.
These two variables are provided for context.
when displaying a node).
$comment
Full comment object.
Full comment object.
$content
The main content of the current Drupal page.
The main content of the current Drupal page.
$node
Node object the comments are attached to.
Node object the comments are attached to.
$right
The HTML for the right sidebar.
The HTML for the right sidebar.
Footer/closing data
$feed_icons
A string of all feed icons for the current page.
A string of all feed icons for the current page.
Box.tpl.php Variables
$footer_message
The footer message as defined in the admin
The footer message as defined in the admin
settings.
Available variables
$footer
The footer region.
$title
Box title.
ox title.
$closure
Final closing markup from any modules that
Final closing markup from any modules that
$content
Box content.
Box content.
have altered the page. This variable should
have altered the page. This variable should
always be output last, after all other dynamic
always be output last, after all other dynamic
content.
2009-01-31
Available From:
Creative Commons License, Attribution
Creative Commons License, Attribution-ShareAlike2.0

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2