Drupal 7 cheat sheet

page.tpl.php variables
General Utility Variables
$base_path The base URL path of the Drupal installation.
$directory The directory the template is located
$is_front TRUE if the current page is the front page.
$logged_in TRUE if the user is registered and signed in.
$is_admin TRUE if the user has permission to access administration
pages.
Site Identity
$front_page The URL of the front page.
$logo The path to the logo image
$site_name The name of the site
$site_slogan The slogan of the site
$highlight Replace of a $mission
$title_pre!x An array containing additional output populated by mod-
ules
$title The page title
$title_su”x An array containing additional output populated by mod-
ules
$messages HTML for status and error messages
$tabs Tabs linking to any sub-pages beneath the current page
$action_links Actions local to the page
$feed_icons A string of all feed icons for the current page.
$node The node object
Navigation
$main_menu An array containing the Main menu links for the
site, if they have been con!gured.
$secondary_menu An array containing the Secondary menu links for
the site, if they have been con!gured.
$breadcrumb: The breadcrumb trail for the current page.
html.tpl.php variables
$css An array of CSS !les for the current page.
$language The language the site is being displayed in.
$language->dir contains the language direction. It will either be ÔltrÕ or ÔrtlÕ.
$language->language contains its textual representation.
$head_title A modi!ed version of the page title, for use in the TITLE tag.
$head_title_array An associative array containing
title : The title of the current page, if any.
name: The name of the site.
slogan: The slogan of the site, if any, and if there is no title.
$head Markup for the HEAD section (including meta tags, keyword
tags, and so on).
$styles Style tags necessary to import all CSS !les for the page
$scripts Script tags necessary to load the JavaScript !les and settings
for the page.
$page_top Initial markup from any modules that have altered the page.
This variable should
$page The rendered page content.
$page_bottom Final closing markup from any modules that have altered
the page. This variable should always be output last, after all
other dynamic content.
$classes String of classes that can be used to style contextually
through CSS.
block.tpl.php variables
Available Variables
$title Block title
$content Block content.
$block->module Module that generated the block.
$block->delta An ID for the block
$block->region The block region embedding the current block
$classes String of classes that can be used to style contextually
through CSS
$title_pre!x An array containing additional output
$title_su”x An array containing additional output
Helper Variables
$classes_array Array of html class attribute values
$block_zebra Outputs ÔoddÕ and ÔevenÕ dependent on each block region.
$zebra Same output as $block_zebra but independent of any block
region.
$block_id Counter dependent on each block region.
$id Same output as $block_id but independent of any block
region.
$is_front Flags true when presented in the front page
$logged_in lags true when the current user is a logged-in member.
$is_admin Flags true when the current user is an administrator.
$block_html_id A valid HTML ID and guaranteed unique.

node.tpl.php variables

Available Variables
$title The title of the node.
$content An array of node items. Use render($content) to print
them all, or print a subset such as render($content[Ô!eld_
exampleÕ]). Use hide($content[Ô!eld_exampleÕ]) to tempo-
rarily suppress the printing of a given element.
$user_picture The node authorÕs picture from user-picture.tpl.php.
$date Formatted creation date
$name Themed username of node author output from theme_
username().
$terms the themed list of taxonomy term links output from
theme_links().
$node_url Direct url of the current node.
$display_submitted Whether submission information should be displayed.
$submitted Submission information created from $name and $date
during
$classes String of classes that can be used to style contextually
through CSS
$title_pre!x An array containing additional output populated by
modules
$title_su”x An array containing additional output populated by
modules
Other variables
$node Full node object
$type Node type
$comment_count Number of comments attached to the node.
$uid User ID of the node author.
$created Time the node was published formatted in Unix times-
tamp.
$classes_array Array of html class attribute values.
$zebra Outputs either ÒevenÓ or ÒoddÓ.
$id Position of the node. Increments each time itÕs output.
$terms Outputs taxonomy terms associated to nodes
Node Status
$view_mode View mode, e.g. ÔfullÕ, ÔteaserÕ.
$teaser Flag for the teaser state (shortcut for $view_mode ==
ÔteaserÕ)
$page: Flag for the full page state.
$promote lag for front page promotion state.
$sticky Flags for sticky post setting.
$status Flag for published status.
$comment State of comment settings for the node.
$readmore Flags true if the teaser content of the node cannot hold
the main body content.
$is_front: Flags true when presented in the front page.
$logged_in Flags true when the current user is a logged-in member.
$is_admin Flags true when the current user is an administrator.
comment.tpl.php variables
$author Comment author
$content An array of comment items. Use render($content) to print
them all, or print a subset such as render($content[Ô!eld_
exampleÕ]).
$created Formatted date and time for when the comment was cre-
ated
$changed Formatted date and time for when the comment was last
changed.
$new New comment marker.
$permalink Comment permalink.
$submitted Submission information created from $author and $cre-
ated
$picture Authors picture.
$signature Authors signature.
$status Comment status
$title Linked title.
$classes tring of classes that can be used to style contextually
through CSS.
$title_pre!x An array containing additional output populated by
modules
$title_su”x An array containing additional output populated by
modules
These two variables are provided for context
$comment Full comment object.
$node Node object the comments are attached to.
Template files
[themename].info Meta data, style sheets, JavaScripts, block regions
html.tpl.php Page wrapper for your theme. Here you have the DOCTYPE declaration, the <head> info, and page closer.
page,tpl.php Default theme implementation to display a single Drupal page.
region.tpl.php v
Default theme implementation to display a region.
block.tpl.php Default theme implementation to display a block.
node.tpl.php Default theme implementation to display a node.
node–[content-type].tpl.php Template for displaying a node of a speci!c content type.
page–front.tpl.php Default theme implementation to display a custom frontpage
node–blog.tpl.php Default theme implementation to display a node of type blog
page–node-[#].tpl.php Theme implementation to display page with node ID #
block–[region].tpl.php Theme implementation for block in region name
html.tpl.php code
$header <head pro!le=Ó<?php print $grddl_pro!le; ?>Ó>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $scripts; ?>
</head>
body <body class=Ó<?php print $classes; ?>Ó <?php print $attributes;?>>
<div id=Óskip-linkÓ>
<a href=Ó#main-menuÓ><?php print t(ÔJump to NavigationÕ); ?></a>
</div>
<?php print $page_top; ?>
<?php print $page; ?>
<?php print $page_bottom; ?>
</body>
Logo <?php if ($logo): ?>
<a href=Ó<?php print $front_page; ?>Ó title=Ó<?php print t(ÔHomeÕ); ?>Ó rel=ÓhomeÓ id=ÓlogoÓ><img src=Ó<?php print $logo; ?>Ó alt=Ó<?php print t(ÔHomeÕ);
?>Ó /></a>
<?php endif; ?>
Site Name <?php if ($site_name): ?>
<?php if ($title): ?>
<div id=Ósite-nameÓ><strong>
<a href=Ó<?php print $front_page; ?>Ó title=Ó<?php print t(ÔHomeÕ); ?>Ó rel=ÓhomeÓ><span><?php print $site_name; ?></span></a>
</strong></div>
<?php else: ?>
<h1 id=Ósite-nameÓ>
<a href=Ó<?php print $front_page; ?>Ó title=Ó<?php print t(ÔHomeÕ); ?>Ó rel=ÓhomeÓ><span><?php print $site_name; ?></span></a>
</h1>
<?php endif; ?>
<?php endif; ?>
Site Slogan <?php if ($site_slogan): ?>
<div id=Ósite-sloganÓ><?php print $site_slogan; ?></div>
<?php endif; ?>
Header <?php print render($page[ÔheaderÕ]); ?>
Highlight <?php print render($page[ÔhighlightÕ]); ?>
Breadcrum <?php print $breadcrumb; ?>
Title Pre!x <?php print render($title_pre!x); ?>
Page Title <h1 class=ÓtitleÓ id=Ópage-titleÓ><?php print $title; ?></h1>
Title Su”x <?php print render($title_su”x); ?>
Messages <?php print $messages; ?>
Tabs <?php print render($tabs); ?>
Help <?php print render($page[ÔhelpÕ]); ?>
Content <?php print render($page[ÔcontentÕ]); ?>
Action Links <ul class=Óaction-linksÓ><?php print render($action_links); ?></ul>
Main Menu <?php print theme(Ôlinks__system_main_menuÕ, array(
ÔlinksÕ => $main_menu,
ÔattributesÕ => array(
ÔidÕ => Ômain-menuÕ,
ÔclassÕ => array(ÔlinksÕ, Ôclear!xÕ),
),
ÔheadingÕ => array(
ÔtextÕ => t(ÔMain menuÕ),
ÔlevelÕ => Ôh2Õ,
ÔclassÕ => array(Ôelement-invisibleÕ),
),)); ?>
Secondary Menu <?php print theme(Ôlinks__system_secondary_menuÕ, array(
ÔlinksÕ => $secondary_menu,
ÔattributesÕ => array(
ÔidÕ => Ôsecondary-menuÕ,
ÔclassÕ => array(ÔlinksÕ, Ôclear!xÕ),
),
ÔheadingÕ => array(
ÔtextÕ => t(ÔSecondary menuÕ),
ÔlevelÕ => Ôh2Õ,
ÔclassÕ => array(Ôelement-invisibleÕ),
),)); ?>
Navigation <?php print render($page[ÔnavigationÕ]); ?>
Sidebar Region <?php print render($page[Ôsidebar_!rstÕ]); ?>
Footer <?php print render($page[ÔfooterÕ]); ?>

 

Source:batayneh.me

Comments
One Response to “Drupal 7 cheat sheet”
  1. I think the admin of this site is truly working hard
    for his website, for the reason that here every material is quality based material.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.