<?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>Quite a Bright Light &#187; Drupal</title>
	<atom:link href="http://www.quitebrightlight.com/category/drupal/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.quitebrightlight.com</link>
	<description></description>
	<lastBuildDate>Mon, 10 May 2010 19:40:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Drupal 6: adding and modifying html using javascript</title>
		<link>http://www.quitebrightlight.com/2010/02/drupal-6-adding-and-modifying-html-using-javascript/</link>
		<comments>http://www.quitebrightlight.com/2010/02/drupal-6-adding-and-modifying-html-using-javascript/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 21:29:40 +0000</pubDate>
		<dc:creator>jefke</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://www.quitebrightlight.com/?p=58</guid>
		<description><![CDATA[


A while ago, I had a simple website, with a simple js script for calculating a price based on some user input. The script uses an updater function that, after all required choices have been made (radio buttons), calculates the final price and shows the price. It does this by adding html to a predefined [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-0445421940264769";
google_ad_slot = "7713378196";
google_ad_width = 468;
google_ad_height = 15;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p>A while ago, I had a simple website, with a simple js script for calculating a price based on some user input. The script uses an updater function that, after all required choices have been made (radio buttons), calculates the final price and shows the price. It does this by adding html to a predefined &#8216;price div&#8217;  (price.innerHTML = &#8220;&#8230;&#8221;) and setting it&#8217;s height from 0 to &#8216;auto&#8217;. Nothing fancy, but worked quite nice.<br />
Upon changing the website for a Drupal site, I was confronted with implementing the js within Drupal. And even though it wasn&#8217;t really hard, it took me a while to figure it out, so I thought I&#8217;d share my findings, hoping they would be useful to somebody. </p>
<p>First of all, I created a normal page within Drupal. The downside of the method (to some people) is that I had to enable PHP for the page input. But as I am the only person ever seeing an input form on this particular site, I didn&#8217;t care too much. For adding the required js (and some extra css for that page), I used: </p>
<div class="insertcode">drupal_add_js(&#8217;sites/all/js/prices.js&#8217;); drupal_add_js(&#8217;sites/all/js/updater.js&#8217;);<br />
drupal_set_html_head(&#8216;&lt;script type=&#8221;text/javascript&#8221;><br />
window.onload = function() {<br />
includePrices();<br />
};</script><br />
');<br />
drupal_add_css(path_to_theme().'/prices.css', 'theme', 'all', TRUE);<br />
$styles = drupal_get_css();
</div>
<p>And then I added an html form which calls the updater function on each click. This makes it possible to have the second choice customers have to make depend on the first choice they make.</p>
<div class="insertcode">
&lt;div onclick="update();" id="priceform"><br />
&lt;div onclick="update();" id="house_type"><br />
&lt;form id="typeform"><br />
    Type house:<br />
    &lt;input type="radio" value="1" ...<br />
&lt;/form><br />
...
</div>
<p>Works like a charm for me...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quitebrightlight.com/2010/02/drupal-6-adding-and-modifying-html-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal: Random sort in Views 2</title>
		<link>http://www.quitebrightlight.com/2009/12/drupal-random-sort-in-views-2/</link>
		<comments>http://www.quitebrightlight.com/2009/12/drupal-random-sort-in-views-2/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 12:46:32 +0000</pubDate>
		<dc:creator>jefke</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[Views 2]]></category>

		<guid isPermaLink="false">http://www.quitebrightlight.com/?p=38</guid>
		<description><![CDATA[


Without a doubt, the Views module is one of those Drupal modules without which Drupal wouldn&#8217;t be the same. With Drupal 6, Views got a major revision, and I must say I quite like the new interface. There was one thing that I couldn&#8217;t figure out immediately however: how to random sort the selection. I [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-0445421940264769";
google_ad_slot = "7713378196";
google_ad_width = 468;
google_ad_height = 15;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p>Without a doubt, the Views module is one of those Drupal modules without which Drupal wouldn&#8217;t be the same. With Drupal 6, Views got a major revision, and I must say I quite like the new interface. There was one thing that I couldn&#8217;t figure out immediately however: how to random sort the selection. I should have looked harder in the sort criteria &#8211; which is the most logical place to put it &#8211; but I was sort of expecting the possiblity to add randomness to any sort criterion I selected (e.g. node:type). Not so: <strong>in the list with all possible criteria, you have to select &#8220;global:random&#8221;</strong>. </p>
<p>Still not sure whether that is the most logical way of doing it. Personally, I would think adding &#8220;random&#8221; as a choice for each criterion (besides &#8220;ascending&#8221; and &#8220;descending&#8221;) would yield a much finer granularity <em>and</em> makes more sense. The fact that the random sort criterion is listed as &#8220;global:random asc&#8221; (asc for ascending) doesn&#8217;t really help changing this view either. </p>
<p>But probably there is a good reason for doing it this way. To paraphrase a French proverb: The programmer has his reasons that reason doesn&#8217;t know.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.quitebrightlight.com/2009/12/drupal-random-sort-in-views-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IP based redirect for bots using .htaccess</title>
		<link>http://www.quitebrightlight.com/2009/04/ip-based-redirect-for-bots-usin-htaccess/</link>
		<comments>http://www.quitebrightlight.com/2009/04/ip-based-redirect-for-bots-usin-htaccess/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 21:01:53 +0000</pubDate>
		<dc:creator>jefke</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.quitebrightlight.com/?p=22</guid>
		<description><![CDATA[Like all of us &#8211; I think &#8211; I really hate comment spammers. I really hate unruly bots, actually. I really do. If you start keeping stats of visitors on your site, you&#8217;ll quickly spot bots crawling all over your site, searching for all sorts of ways to epxloit your website. They look for email [...]]]></description>
			<content:encoded><![CDATA[<p>Like all of us &#8211; I think &#8211; I really hate comment spammers. I really hate unruly bots, actually. I really do. If you start keeping stats of visitors on your site, you&#8217;ll quickly spot bots crawling all over your site, searching for all sorts of ways to epxloit your website. They look for email addresses, they try to submit spam comments, they try to find ways to enter your database, they do everything but help you. They are leeches. They stink. I really don&#8217;t like them&#8230;</p>
<p>Luckily, there are different ways to handle bots as well. If you&#8217;re using a .htacces file, for example, you can add a snippet to block the vermin based on their IP address. An idea I liked even better is to <a href="http://amifamousnow.com/how-to/howto-htaccess-ip-redirect-to-any-site/" onclick="pageTracker._trackPageview('/outgoing/amifamousnow.com/how-to/howto-htaccess-ip-redirect-to-any-site/?referer=');">redirect the bots</a> to a site that tries to reeducate the bots. You never know. </p>
<p>In stead of redirecting the bots to a governement site where they can take a seat and follow a hands-on course on cyber crimes, another good idea is to send the little bastards to a <a href="http://www.americanbeaconfunds.com/contact/spam/trap.html" onclick="pageTracker._trackPageview('/outgoing/www.americanbeaconfunds.com/contact/spam/trap.html?referer=');">spam trap page</a>. Gives me visions of all bots in the world swimming around in a pool of interlinked spam pages, never able to get out by them selves. Heaven&#8230;</p>
<p>So that&#8217;s what I do now, I redirect the bots to a spam trap. Typing in the IP&#8217;s in the required format for the .htaccess file, however, can be a PITA. Therefore, I wrote a little script to generate the .htaccess snippet based on a list of IP&#8217;s in their normal format. The .htaccess format itself comes from <a href="http://amifamousnow.com/how-to/howto-htaccess-ip-redirect-to-any-site/" onclick="pageTracker._trackPageview('/outgoing/amifamousnow.com/how-to/howto-htaccess-ip-redirect-to-any-site/?referer=');">Am I Famous Now</a>. Insert the URL where you want to send the bots to or leave the one I use, insert the IP&#8217;s of the bots and push the button:</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0445421940264769";
google_ad_slot = "7713378196";
google_ad_width = 468;
google_ad_height = 15;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<br />
<script type="text/javascript" src="http://www.quitebrightlight.com/wp-includes/js/jquery/jquery.form.js"></script><br />
<script type="text/javascript"> function createhtaccess() {
  var queryString = jQuery("#IPform").formToArray();
  jQuery("#IPresult").load("/scripts/IPredirect.php", queryString);
  jQuery("#IPresult").addClass("insertcode");
  }
  </script></p>
<form id="IPform">
<strong>The URL to refer the bots to:</strong></p>
<div class='field'>
<TEXTAREA name="URL" id="URL" rows="2" cols="60">http://www.americanbeaconfunds.com/contact/spam/trap.html</TEXTAREA>
</div>
<p><strong>The IP&#8217;s to refer (one per line):</strong></p>
<div class='field'>
<TEXTAREA name="IPs" id="IPs" rows="10" cols="60">xxx.xxx.xxx.xxx</TEXTAREA>
</div>
<input type=button value='generate .htaccess snippet' onclick='createhtaccess();' />
</form>
<div name = 'IPresult' id = 'IPresult'></div>
<p>Copy paste the snippet into your .htaccess file, and you&#8217;re all set. (WATCH OUT: if you don&#8217;t know what you&#8217;re doing, messing with .htaccess can wreck your site in a second. Don&#8217;t blame me. I told you.) This works fine, ofcourse, when you can easily keep track of the bots. When you have huge traffic on your site, you probably have a huge number of bots visiting it as well. In that case, you&#8217;re probably better of with a lean and mean, fully automated and integrated bot trapping/blocking device like <a href="http://www.kloth.net/internet/bottrap.php" onclick="pageTracker._trackPageview('/outgoing/www.kloth.net/internet/bottrap.php?referer=');">this</a> or <a href="http://www.kloth.net/internet/bottrap.php" onclick="pageTracker._trackPageview('/outgoing/www.kloth.net/internet/bottrap.php?referer=');">this</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-0445421940264769";
google_ad_slot = "7713378196";
google_ad_width = 468;
google_ad_height = 15;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quitebrightlight.com/2009/04/ip-based-redirect-for-bots-usin-htaccess/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drupal: Combining Taxonomy Menu and Taxonomy Redirect</title>
		<link>http://www.quitebrightlight.com/2009/04/drupal-combining-taxonomy-menu-and-taxonomy-redirect/</link>
		<comments>http://www.quitebrightlight.com/2009/04/drupal-combining-taxonomy-menu-and-taxonomy-redirect/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 10:36:38 +0000</pubDate>
		<dc:creator>jefke</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Taxonomy Menu]]></category>
		<category><![CDATA[Taxonomy Redirect]]></category>

		<guid isPermaLink="false">http://www.quitebrightlight.com/?p=19</guid>
		<description><![CDATA[


Taxonomy Menu is a very nice Drupal module that lets you create a menu based on a content type&#8217;s taxonomy. The taxonomy terms form the menu structure, and the way the nodes are displayed when a menu item (= taxonomy term) is selected can be customised using a custom view. I really like it. I [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-0445421940264769";
google_ad_slot = "7713378196";
google_ad_width = 468;
google_ad_height = 15;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
<p><a onclick="pageTracker._trackPageview('/outgoing/drupal.org/project/taxonomy_menu?referer=');pageTracker._trackPageview('/outgoing/drupal.org/project/taxonomy_menu?referer=');pageTracker._trackPageview('/outgoing/drupal.org/project/taxonomy_menu?referer=');" href="http://drupal.org/project/taxonomy_menu">Taxonomy Menu</a> is a very nice Drupal module that lets you create a menu based on a content type&#8217;s taxonomy. The taxonomy terms form the menu structure, and the way the nodes are displayed when a menu item (= taxonomy term) is selected can be customised using a custom view. I really like it. I like it so much, that I wanted the taxonomy terms displayed in the header of my nodes to link to the same menu structure, so that clicking on them was the same as clicking on the same term in the Taxonomy Menu.</p>
<p>Here enters <a onclick="pageTracker._trackPageview('/outgoing/drupal.org/project/taxonomy_redirect?referer=');pageTracker._trackPageview('/outgoing/drupal.org/project/taxonomy_redirect?referer=');pageTracker._trackPageview('/outgoing/drupal.org/project/taxonomy_redirect?referer=');" href="http://drupal.org/project/taxonomy_redirect">Taxonomy Redirect</a>. This module allows one to rewrite the url that the Taxonomy module creates. So instead of blabla.com/taxonomy/term/999 you can make the link blablabla.com/goto/this/instead/999. For this, you can define a redirect as plain text, or with a php snippet. Due to the link structure Taxonomy Menu uses, I had to resort to php for dynamically creating the Redirect link. The standard format for the link structure for Taxonomy Menu is &#8220;sitename.com/category/vid/pid1/pid2/tid&#8221; (with vid the vocabulary id, pid a parent term id, and tid the term id). The term &#8220;category&#8221; can be set in the settings for Taxonomy Menuy. Using plain text to define the Redirect link would f*** things up when the taxonomy term did not have any parents. Php worked fine, once I found out that the Redirect module defines a variable $tid for the term id, that you can use in your script. The code I used:</p>
<div class="insertcode">&lt;?php<br />
$output = &#8220;category/1/&#8221;;<br />
$parents = taxonomy_get_parents_all($tid);<br />
$parents = array_reverse($parents);<br />
// Remove the child term from the array<br />
array_pop($parents);<br />
foreach ($parents as $parent) {<br />
$output .= &#8220;$parent-&gt;tid&#8221;;<br />
$output .= &#8220;/&#8221;;<br />
}<br />
$output .= $tid;<br />
return $output;<br />
?&gt;</div>
<p>The &#8220;1&#8243; behind &#8220;category&#8221; in the first line is for the vocabulary, so you&#8217;ll have to check what value you need there. Note that using php might not work straight away for anonymous users. To resolve this, have a look <a href="http://www.quitebrightlight.com/2009/04/drupal-using-php-in-taxonomy-redirect-for-anonymous-users/">here</a>&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quitebrightlight.com/2009/04/drupal-combining-taxonomy-menu-and-taxonomy-redirect/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Drupal: using PHP in Taxonomy Redirect for anonymous users</title>
		<link>http://www.quitebrightlight.com/2009/04/drupal-using-php-in-taxonomy-redirect-for-anonymous-users/</link>
		<comments>http://www.quitebrightlight.com/2009/04/drupal-using-php-in-taxonomy-redirect-for-anonymous-users/#comments</comments>
		<pubDate>Thu, 02 Apr 2009 14:03:24 +0000</pubDate>
		<dc:creator>jefke</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[anonymous users]]></category>
		<category><![CDATA[PHP filter]]></category>
		<category><![CDATA[Taxonomy Redirect]]></category>

		<guid isPermaLink="false">http://www.quitebrightlight.com/?p=20</guid>
		<description><![CDATA[As mentioned at drupal.org, there is an issue with Taxonomy Redirect where (at least in Drupal 5, don&#8217;t know about 6) the PHP filter doesn&#8217;t work for anonymous users. Instead of evaluating the PHP snippet, Taxonomy Redirect will return the snippet as text, resulting in very long url holding your script code. As I mentioned [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned at <a href="http://drupal.org/node/401706" onclick="pageTracker._trackPageview('/outgoing/drupal.org/node/401706?referer=');">drupal.org</a>, there is an issue with <a href="http://drupal.org/project/taxonomy_redirect" onclick="pageTracker._trackPageview('/outgoing/drupal.org/project/taxonomy_redirect?referer=');">Taxonomy Redirect</a> where (at least in Drupal 5, don&#8217;t know about 6) the PHP filter doesn&#8217;t work for anonymous users. Instead of evaluating the PHP snippet, Taxonomy Redirect will return the snippet as text, resulting in very long url holding your script code. As I mentioned at drupal.org, this is probably due to the use of the filter_formats() function in taxonomy_redirect_get_php_filter() to find the right identifier for the PHP filter. Because filter_formats checks for user permissions as well, in a default Drupal install it will only return an HTML filter, and no PHP filter. As such, the identifier is set to the default value &#8220;0&#8243;, which is actually the identifier for a text filter. Hence, Taxonomy Redirect returns filtered text instead of a PHP evaluation. This can be resolved by setting the default value for the filter identifier to &#8220;2&#8243; in line 248 of taxonomy_redirect.module (5.x-1.3):</p>
<div class="insertcode">function taxonomy_redirect_get_php_filter() {<br />
$phpfilter = 0;<br />
$filters = filter_formats();<br />
foreach ($filters as $filter) {<br />
&#8230;</div>
<p>becomes:</p>
<div class="insertcode">function taxonomy_redirect_get_php_filter() {<br />
$phpfilter = 2;<br />
$filters = filter_formats();<br />
foreach ($filters as $filter) {<br />
&#8230;</div>
<p>You may want to check whether the identifier for the PHP filter is 2 for you Drupal install. You can verify this in your Drupal database in the filter_formats table.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quitebrightlight.com/2009/04/drupal-using-php-in-taxonomy-redirect-for-anonymous-users/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using BBClone with Drupal 5 or 6</title>
		<link>http://www.quitebrightlight.com/2009/02/using-bbclone-with-drupal-5-or-6/</link>
		<comments>http://www.quitebrightlight.com/2009/02/using-bbclone-with-drupal-5-or-6/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 22:42:12 +0000</pubDate>
		<dc:creator>jefke</dc:creator>
				<category><![CDATA[BBClone]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.quitebrightlight.com/?p=18</guid>
		<description><![CDATA[BBClone is to my knowledge one of the best stat counters freely avaibable. It is written in PHP, and it provides you with a wealth of information, is highly configurable, and doesn&#8217;t require you to mess with database tables. I find it to be very complementary to Google Analytics. It doesn&#8217;t offer the vast analysis [...]]]></description>
			<content:encoded><![CDATA[<p><a onclick="pageTracker._trackPageview('/outgoing/bbclone.de?referer=');pageTracker._trackPageview('/outgoing/bbclone.de?referer=http://www.quitebrightlight.com/wp-admin/post.php?action=edit&amp;post=18&amp;message=4');pageTracker._trackPageview('/outgoing/bbclone.de?referer=http://www.quitebrightlight.com/wp-admin/post.php?action=edit&amp;post=18&amp;message=4');pageTracker._trackPageview('/outgoing/bbclone.de?referer=http://www.quitebrightlight.com/wp-admin/post-new.php');" href="http://bbclone.de">BBClone</a> is to my knowledge one of the best stat counters freely avaibable. It is written in PHP, and it provides you with a wealth of information, is highly configurable, and doesn&#8217;t require you to mess with database tables. I find it to be very complementary to <a onclick="pageTracker._trackPageview('/outgoing/www.google.com/analytics/?referer=');pageTracker._trackPageview('/outgoing/www.google.com/analytics/?referer=http://www.quitebrightlight.com/wp-admin/post.php?action=edit&amp;post=18&amp;message=4');pageTracker._trackPageview('/outgoing/www.google.com/analytics/?referer=http://www.quitebrightlight.com/wp-admin/post.php?action=edit&amp;post=18&amp;message=4');pageTracker._trackPageview('/outgoing/www.google.com/analytics/?referer=http://www.quitebrightlight.com/wp-admin/post-new.php');" href="http://www.google.com/analytics/">Google Analytics</a>. It doesn&#8217;t offer the vast analysis possibilities that Google has to offer, but BBClone does provide you with more information about individual visitors, such as the keywords the used to land at your site. I&#8217;m sure there&#8217;s a certain threshold of daily visitors above which BBClone becomes a bit superfluous because the information is just too much, but when you&#8217;re below that threshold, it&#8217;s a bless.</p>
<p>One of the disadvantages of BBClone, however, is the fact that it cannot be included from within a function. To function properly, BBClone has to be called directly. Calling BBClone is done using:</p>
<div class="insertcode">&lt;?php<br />
define(&#8220;_BBCLONE_DIR&#8221;, &#8220;bbclone/&#8221;);<br />
define(&#8220;COUNTER&#8221;, _BBCLONE_DIR.&#8221;mark_page.php&#8221;);<br />
if (is_readable(COUNTER)) include_once(COUNTER);<br />
?&gt;</div>
<p>Optionally, you can define the refering page using:</p>
<div class="insertcode">&lt;?php<br />
define(&#8220;_BBC_PAGE_NAME&#8221;, &#8220;Test&#8221;);<br />
define(&#8220;_BBCLONE_DIR&#8221;, &#8220;bbclone/&#8221;);<br />
define(&#8220;COUNTER&#8221;, _BBCLONE_DIR.&#8221;mark_page.php&#8221;);<br />
if (is_readable(COUNTER)) include_once(COUNTER);<br />
?&gt;</div>
<p>The pagename and the directory have to be changed according to your needs.</p>
<p>When you&#8217;re not caching your website at all, you can easily add this snippet to you page.tpl.php template, and that should work fine. In this case, you can even use the available Drupal functions to define the page name. When you&#8217;re serving your Drupal cached, then that&#8217;s not possible, however, as page.tpl.php is only called now and again (when the cache is being refreshed). If BBClone could be called from within a function, one could easily write a module calling BBClone during the bootstrap. Alas, that&#8217;s not possible. Therefore, the only possibilties to my knowledge require some core hacking. The one that I like the most, is messing with the main index.php file, because it&#8217;s a very simple file.<br />
Right after the comment, <a onclick="pageTracker._trackPageview('/outgoing/drupal.org/node/182790_comment-281788?referer=');pageTracker._trackPageview('/outgoing/drupal.org/node/182790_comment-281788?referer=http://www.quitebrightlight.com/wp-admin/post.php?action=edit&amp;post=18&amp;message=4');pageTracker._trackPageview('/outgoing/drupal.org/node/182790_comment-281788?referer=http://www.quitebrightlight.com/wp-admin/post.php?action=edit&amp;post=18&amp;message=4');" href="http://drupal.org/node/182790#comment-281788">you can add</a>:</p>
<div class="insertcode">&lt;?php<br />
$bbrequest = strtolower($_SERVER["REQUEST_URI"]);<br />
define(&#8220;_BBC_PAGE_NAME&#8221;, $bbrequest);<br />
define(&#8220;_BBCLONE_DIR&#8221;,$_SERVER['DOCUMENT_ROOT'].&#8221;/statcount/&#8221;);<br />
define(&#8220;COUNTER&#8221;, _BBCLONE_DIR.&#8221;mark_page.php&#8221;);<br />
if (is_readable(COUNTER)) include_once(COUNTER);<br />
?&gt;</div>
<p>(Ofcourse, you don&#8217;t have to include the php tags.) The first two lines define the page name as the url requested from the server. Because the bootstrap has not even been initiated, using Drupal functions is not possible. One could write a more elaborate function to extract the page title, but I think this solution is both elegant and simple. And it works&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quitebrightlight.com/2009/02/using-bbclone-with-drupal-5-or-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal: Invoke comments using contemplate</title>
		<link>http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/</link>
		<comments>http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 17:43:03 +0000</pubDate>
		<dc:creator>jefke</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[Contemplate]]></category>

		<guid isPermaLink="false">http://www.quitebrightlight.com/?p=15</guid>
		<description><![CDATA[The Contemplate module (or Content Templates module) is a bless when you want to give a certain node type a specific layout. It&#8217;s easier than using node-type.tpl.php from an administrative point of view because you don&#8217;t need to upload new css-files, and from a designing point of view because the module provides a convenient list [...]]]></description>
			<content:encoded><![CDATA[<p>The <a onclick="pageTracker._trackPageview('/outgoing/drupal.org/project/contemplate?referer=');pageTracker._trackPageview('/outgoing/drupal.org/project/contemplate?referer=http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/');pageTracker._trackPageview('/outgoing/drupal.org/project/contemplate?referer=http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/');pageTracker._trackPageview('/outgoing/drupal.org/project/contemplate?referer=http://www.quitebrightlight.com/wp-admin/post.php?action=edit&amp;post=15');" href="http://drupal.org/project/contemplate" target="_blank">Contemplate module</a> (or Content Templates module) is a bless when you want to give a certain node type a specific layout. It&#8217;s easier than using node-type.tpl.php from an administrative point of view because you don&#8217;t need to upload new css-files, and from a designing point of view because the module provides a convenient list of available variables.</p>
<p>What wasn&#8217;t immediately clear to me, however, was how to include the commenting section in a node using Contemplate (or node-type.tpl.php for that matter). A search on drupal.org eventually <a onclick="pageTracker._trackPageview('/outgoing/drupal.org/node/122240_comment-649749?referer=');pageTracker._trackPageview('/outgoing/drupal.org/node/122240_comment-649749?referer=http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/');pageTracker._trackPageview('/outgoing/drupal.org/node/122240_comment-649749?referer=http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/');pageTracker._trackPageview('/outgoing/drupal.org/node/122240_comment-649749?referer=http://www.quitebrightlight.com/wp-admin/post.php?action=edit&amp;post=15');" href="http://drupal.org/node/122240#comment-649749" target="_blank">leaded me</a> to using this:</p>
<div class="insertcode">&lt;?php<br />
if (function_exists(&#8216;comment_render&#8217;) &amp;&amp; user_access(&#8216;post comments&#8217;)) {<br />
print &#8220;&lt;div class=&#8217;cscomment&#8217;&gt;&#8221;;<br />
print &#8220;&lt;h3 class=&#8217;field-label&#8217;&gt;Comments&lt;/h3&gt;&#8221;;<br />
print comment_render($node);<br />
$node-&gt;comment = NULL;<br />
print &#8220;&lt;/div&gt;&#8221;;<br />
}?&gt;</div>
<p>which works fine at the moment.</p>
<p>Note that this is working for Drupal 5, but in the <a onclick="pageTracker._trackPageview('/outgoing/drupal.org/node/122240?referer=');pageTracker._trackPageview('/outgoing/drupal.org/node/122240?referer=http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/');pageTracker._trackPageview('/outgoing/drupal.org/node/122240?referer=http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/');" href="http://drupal.org/node/122240" target="_blank">same thread</a>, solutions for Drupal 6 have been suggested.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quitebrightlight.com/2009/01/drupal-comments-using-contemplate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
