Author Archives: jonatxa

Solving IE7 hasLayout bug on Drupal 6 zen subtheme

To avoid content on second column jump over the left sidebar on links hover zoom:1 needs to be added to the #main division. I find that adding display:inline-block to the second sidebar has also helped on occasions.The exact problem and its solution is best described at:

More on the hasLayout bug can be read at:


Displaying a block based on the taxonomy term in the URL

I wanted to display node content in a block based on it’s taxonomy term’s URL, so that from the user can see a list of nodes of term exterior. The problem is that blocks don’t pull arguments from the URL same way as a page view. This can be done by adding a term:ID argument, providing a default argument as php code. The following snippet takes the term id so that Drupal can use it as an argument for the content to be displayed:

//break path into an array
$path = explode(‘/’, $path);
$termname = array_pop($path);
//convert the dashes to spaces
$termname = str_replace(“-“, ” “, $termname);
$terms = taxonomy_get_term_by_name($termname );
$term = reset($terms);
return $term->tid;

More on this:

Increse upload file size

If you don´t have access to the the php.ini file, Drupal can override the php.ini files values to increase the upload limit. This is done in the root´s .htacess file, by adding:
php_value upload_max_filesize 3M
php_value post_max_size 7M

…as explained in

Views slideshow module IE issue

Each slide takes the bg color of the parent div (when it is not transparent), which causes problems on IE7 and 8. This can be fixed as explained in

Multisite Drupal installation and virtualhosts

Dynamic mp3 playlist in Drupal 6

I tried generating dynamic playlists with swftools or jw player module without success, but finally got Views to generate a playlist feed imported into an embedded mp3 player on the fly. These are the modules needed:

  • CCK + filefield (for the mp3 files)
  • Views bonus pack (to export fields to XML).

And the embeded mp3 player that I used can be found in

The view filters by content of type song (in my case) and displays fields node title and the song content with a URL to file format. Adding a “path” as custom label for this last field helps to construct the correct xml tag for the mp3 player later. The view is displayed in a feed with a style of xml file and a path of playlist.xml for this example. At this point the supplied views-bonus-export-xml.tpl.php template file needs to be overriden to make it match with the xml file expected by the premiumbeat mp3 player (see the xml file that comes as an example with the player download). Instead of the <node> tags I used <item>, and I also needed to get rid of the <xml> tags and added <playlist>. The resulting file:

print '<?xml version="1.0" encoding="UTF-8" ?>';
<?php foreach ($themed_rows as $count => $row): ?>
<?php foreach ($row as $field => $content):
$label = $header[$field] ? $header[$field] : $field;
<<?php print $label; ?>><?php print $content; ?></<?php print $label; ?>>
<?php endforeach; ?>
<?php endforeach; ?>

The generated xml file looks like this:

<?xml version="1.0" encoding="UTF-8" ?><playlist>

The last thing needed is to embed in a block the player. The only thing we have to be careful with is the path, both to the xml playlist generated by the view and the actual mp3 player swf file.

--><script type="text/javascript" src=""></script>
<div id="player-holder">
<script type="text/javascript">
var options = {};
options.playlistXmlPath = "";

var params = {};
params.allowFullscreen = "true";
params.allowScriptAccess = "always";

swfobject.embedSWF("http:/", "player-holder", "250", "180", "9.0.0",false, options, params, {});
</script><!-- END PLAYER EMBED CODE -->

That´s all!

Allowing bigger size file uploads

To allow for bigger size file uploads, as with large mp3 files, tweak the values post_max_size and upload_max_filesize in the php.ini file.

login & ckfinder issues: setting the $cookie_domain variable

I have experienced ckfinder permission issues that are resolved by uncommenting and setting the $cookie_domain variable in the settings.php file to the domain name. If this is not configured right can lead into login issues (“Access denied…”). What works for me is to set up the variable as follows:

$cookie_domain = ‘’;

It is important to note that the dot after the comma can´t be forgotten.

This issue was explained and resolved here:

drop down menus in drupal 6

Using nice menu module is needed to achieve a drop down menu effect. It needs to be enabled and assigned to a region where the navigation bar is. If using zen theme, overflow:hidden style in layout-fixed.css file for selector #navigation (line 226) needs to be removed. In the page.tpl.php file, instead of printing $navigation we need this line: . Css styling foes the rest.

Trimming text in a teaser causing issue

If a user adds html code to style content, like adding bold or italics for some text, and a view is displaying a teaser of that particular content trimming text down to say 100 characters, it can happen that closing tags are left out therefore extending italics or bold style to the rest of the page. This can be easily solved by making sure that each view that contains a teaser displayed has set either “Field can contain HTML” option (which will ensure tags are properly closed) or “Strip HTML tags”, which will output just plain text for the teaser view. An example of this and its solution was reported on: