How to use Drupal theme variables?
Add the following codes into themplt.php
<?php
yourthemename_preprocess_page(&$variables) {
$variables['happyday'] = 'Happy ' . format_date(time(), 'custom', 'l') . '!';
}
?><?php
print $happyday;
?>Complex themes have many different block regions, some regions will only appear on certain pages or when viewing nodes of certain types. One very common use-case is
to have both a page.tpl.php, and a page-front.tpl.php, each of which print out different regions.
How to define block regions in Drupal? Simply add a couple lines in your theme’s .info file:
regions[ad_top] = Ad Top
regions[ad_bottom] = Ad Bottom
regions[front_sidebar] = Front Sidebar
regions[sidebar_ad] = Sidebar Ad
regions[content] = Content
regions[feature_a] = Feature A
regions[feature_b] = Feature B
regions[feature_c] = Feature C
regions[feature_d] = Feature D
And then in your *.tpl.php file, wherever you want the region to appear, simply print out its machine-readable name.
<?php
print $feature_a;
?><front> page.Also see http://www.v7n.com/forums/web-design-lobby/115171-background-image-inline-list-ie.html
FF/IE hacks:
padding: 2px 0 2px 18px; /*FF LTR */
padding: 12px 0 2px 18px\9; /*IE8 LTR */
+padding: 2px 0 2px 18px; /*IE7 LTR */
_padding: 2px 0 2px 18px; /*IE6 LTR */
//add the client side js
function hook_init()
{
drupal_add_js(‘$(document).ready(
function(…){});
‘,’inline’);
}
//server side callback
function my()
{
drupal_set_header(‘Content-Type: text/plain; charset: utf-8′);
$output = ”;
…
echo json_encode($output);
}