Thursday, September 22, 2011

How to display webforms in colorbox in drupal

I've found an easy way to implement this feature without coding that works for me:
  1.  you can enable webforms as a block --> select the webform content you created, tab "Webform" > "Form Settings" > "Enable as a block"
  2. put the block inside a region, I've put mine in the footer region
  3. CSS style the footer webform block as "display: none;"
  4. for colorbox: in "configuration", "Media", "Colorbox" --> advanced settings, activate "Enable Colorbox inline"
  5. add this as the html code for opening the colorbox webform link: <a class="colorbox-inline" href="?width=310&amp;height=460&amp;inline=true#name-of-your-block">

Tuesday, September 20, 2011

Create region in node.tpl.php (drupal 6)


1.Add code in yourtheme.info

regions[region_name] =  Region Name


2.Add funciton in template.php


function THEME_NAME_preprocess_node(&$variables, $hook) {
  $variables['
region_name'] = theme('blocks', 'region_name');
}



3.Add code in node.tpl.php



<?php if ($region_name) { ?><div class="region_name"><?php print $region_name?></div><?php }; ?>