<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thomas Hambach - Web engineer &#187; views</title>
	<atom:link href="http://www.rdlt.com/category/drupal/views/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rdlt.com</link>
	<description>Web development, Web design &#38; Usability</description>
	<lastBuildDate>Mon, 06 Dec 2010 09:45:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Drupal 5 Views Module Breaks Block Administration</title>
		<link>http://www.rdlt.com/drupal-5-views-module-breasks-block-administration.html</link>
		<comments>http://www.rdlt.com/drupal-5-views-module-breasks-block-administration.html#comments</comments>
		<pubDate>Fri, 31 Jul 2009 11:45:31 +0000</pubDate>
		<dc:creator>Thomas Hambach</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://www.rdlt.com/?p=189</guid>
		<description><![CDATA[While working on a new Drupal 5.19 powered website that has the latest view module enabled, my coworker noticed a strange feature. Once you activated more than one template and tried to switch over to manage the blocks on an other template than garland you will see it switching to garland 50% of the time. [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox" href="http://www.rdlt.com/wp-content/uploads/2009/07/kitten_normal.jpg"><img class="size-thumbnail wp-image-195" title="poor little kitten with big round eyes" src="http://www.rdlt.com/wp-content/uploads/2009/07/kitten_normal-150x150.jpg" alt="poor little kitten with big round eyes" width="150" height="150" /></a> While working on a new Drupal 5.19 powered website that has the latest view module enabled, my coworker noticed a strange feature. Once you activated more than one template and tried to switch over to manage the blocks on an other template than garland you will see it switching to garland 50% of the time.<span id="more-189"></span></p>
<p>The problem here lies in the views module. This module makes a call to the t() function which calls a theme function which eventually has to call init_theme() to check which template it should use. Once the init_theme() funcion has been called, the global variable $theme will be set and any other calls to init_theme() will be . Being called so early in time, the init_theme() function has no idea it still has to switch to a custom theme defined by the blocks module.</p>
<p>The fix involves <a rel="lightbox" href="http://www.vrag.ru/images/news_pic/dead_kitten.jpg">killing a kitten</a>&#8230; also know as <a href="http://drupal.org/node/144376" target="_blank">hacking drupal core</a>. Fire up your favorite editor, open up includes/theme.inc.php and find the following lines of code.</p>
<pre><code class="php">function init_theme() {
  global $theme, $user, $custom_theme, $theme_engine, $theme_key;

  // If $theme is already set, assume the others are set, too, and do nothing
  if (isset($theme)) {
    return;
  }
</code></pre>
<p>and replace it with</p>
<pre><code class="php">function init_theme() {
  global $theme, $user, $custom_theme, $theme_engine, $theme_key;

  // If $theme is already set, assume the others are set, too, and do nothing
  // patchy patchy!
  if (isset($theme)) {
  	if(isset($custom_theme)) {
  		if($theme == $custom_theme) {
  			return;
  		}
  	} else {
    	return;
  	}
  }</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rdlt.com/drupal-5-views-module-breasks-block-administration.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

