How to customiz a block in a region
This code is useful when you want to customize a block, as in this case wrap a transparent image link around a flash object in a specific region to get a flash object to become a link.
Add this code in your themes template.tpl.php and paste the flash object code in a new block and publish it the my_region.
<?php
/**
* Override or insert variables into the block templates.
*
* @param $vars
* An array of variables to pass to the theme template.
* @param $hook
* The name of the template being rendered ("block" in this case.)
*/
function zen_preprocess_block(&$vars, $hook) {
if($vars['block']->region == "my_region"){
$link_url = variable_get('flash_link_url', 'my_link');
$style_img = 'style="z-index: 1;
position: absolute;
left: 0pt;
top: 0pt;
height: 200px;
width: 690px;"';
$style_flash = 'style="z-index: 0;
position: absolute;
left: 0pt;
top: 0pt;"';
$transparent_link = '<div '.$style_img.'>
<a style="text-decoration: none;" href="'.$link_url.'">
<img '.$style_img.' src="flash_banner_transparens.png" alt=""/>
</a>
</div>
<div '.$style_flash.'>';
$transparent_link_end = '</div>';
$vars['block']->content = $transparent_link . $vars['block']->content . $transparent_link_end;
}
...
}
?>
Knowledge keywords: