<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>drupal-6 &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/drupal-6/</link>
	<description>Feed of posts on WordPress.com tagged "drupal-6"</description>
	<pubDate>Wed, 06 Jan 2010 16:11:35 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[How to automatically translate your Drupal module]]></title>
<link>http://chirale.wordpress.com/2009/12/21/how-to-automatically-translate-your-drupal-module/</link>
<pubDate>Mon, 21 Dec 2009 16:46:10 +0000</pubDate>
<dc:creator>chirale</dc:creator>
<guid>http://chirale.wordpress.com/2009/12/21/how-to-automatically-translate-your-drupal-module/</guid>
<description><![CDATA[You&#8217;ve created your module. But how to translate it into different languages? Tested with: Tra]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>You&#8217;ve created your module. But how to translate it into different languages?</p>
<p>Tested with:</p>
<ul>
<li>Translation template extractor 6.x-3.0</li>
<li>Drupal 6.x</li>
<li>English default + Italian translation</li>
</ul>
<p>Prerequisites:</p>
<ul>
<li>Another language active apart default (English)</li>
<li>Use <a href="http://api.drupal.org/api/function/t/6" target="_blank">t() function</a> for all translatable string, including ones on <code>my_funny_module.admin.inc</code> (Administration interface).</li>
</ul>
<p>If you use t() function correctly on your module, you can create your own translation using the handy <a href="http://drupal.org/project/potx" target="_blank">Translation template extractor module</a>.</p>
<ol>
<li>Download and install <a href="http://drupal.org/project/potx" target="_blank">Translation template extractor module</a>.</li>
<li>Create a directory named &#8220;translations&#8221; within <code>my_funny_module</code> directory (your module directory)</li>
<li>Go to <code>admin/build/translate/extract</code></li>
<li>Select your module from Directory lists</li>
<li>Select &#8220;Language independent template&#8221; and click &#8220;Extract&#8221;</li>
<li>Save file to <code>my_funny_module/translations</code> directory as <code>my_funny_module.pot</code></li>
<li>In the same screen, select &#8220;Template file for Italiano translations&#8221; (where <em>Italiano</em> is your destination language)</li>
<li>If you&#8217;ve already translated some strings into <em>Italiano</em> language, check &#8220;Include translations&#8221; to include these strings</li>
<li>Click &#8220;Extract&#8221;, and save file to <code>my_funny_module/translations</code> directory as <code>it.po</code>, where &#8220;it&#8221; is the <a href="http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes" target="_blank">ISO 639-2</a> code for <em>Italiano</em> language</li>
<li>You can add information about translation changing the first part of both files (translator mail, name, etc.)</li>
</ol>
<p>Now, when you install your module translation strings will be added automatically. If you apply some changes to these files, and in any case the first time you complete this procedure on an active module, you have to refresh translation cache. To do this, go to <code>admin/build/translate/refresh</code> and use <em>Refresh strings</em> and <em>Update translations</em> after you&#8217;ve checked all boxes. If problem persists (strings are not updated or you got some weird errors), try to reinstall your module.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Adding a Gmap View to a .tpl file]]></title>
<link>http://randomtechramblings.wordpress.com/2009/12/18/adding-a-gmap-view-to-a-tpl-file/</link>
<pubDate>Fri, 18 Dec 2009 11:05:47 +0000</pubDate>
<dc:creator>Freddie Karlbom</dc:creator>
<guid>http://randomtechramblings.wordpress.com/2009/12/18/adding-a-gmap-view-to-a-tpl-file/</guid>
<description><![CDATA[Currently I&#8217;m trying to do some implementations between Taxonomy and Gmap Views, where nodes w]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Currently I&#8217;m trying to do some implementations between Taxonomy and Gmap Views, where nodes with a certain region (taxonomy term) will be shown in a Gmap View when accessing the region page (page-taxonomy-term.tpl.php).</p>
<p>At first I thought that this would be as simple as usual implementing a view by just calling it with:<br />
<code>&#60;?php print views_embed_view("<strong>name-of-view</strong>", "default", argument); ?&#62;</code></p>
<p>This resulted in an error message though stating that:</p>
<blockquote><p>&#8220;Javascript is required to view this map&#8221;</p></blockquote>
<p>Not very helpful, since Javascript is up and running. The problem is that some module specific .js files need to be imported, not that Javascript isn&#8217;t running. In the head of your .tpl file you need to add some scripts. What worked for me was as follows:</p>
<p><code> &#60;script src="http://maps.google.com/maps?file=api&#38;amp;v=2.115&#38;amp;key=</code><strong>[Your API key here directly followed by]</strong><code>&#38;amp;hl=en" type="text/javascript"&#62;&#60;/script&#62;<br />
&#60;script type="text/javascript" src="</code><strong>[change following src:s to your path to the gmap module]</strong><code>/gmap/js/gmap.js?Q"&#62;&#60;/script&#62;<br />
&#60;script type="text/javascript" src="/dp/sites/all/modules/gmap/js/marker.js?Q"&#62;&#60;/script&#62;<br />
&#60;script type="text/javascript" src="/dp/sites/all/modules/gmap/js/gmap_marker.js?Q"&#62;&#60;/script&#62;<br />
&#60;script type="text/javascript" src="/dp/sites/all/modules/gmap/js/poly.js?Q"&#62;&#60;/script&#62;<br />
&#60;script type="text/javascript" src="/dp/sites/default/files/js/gmap_markers.js?Q"&#62;&#60;/script&#62;<br />
&#60;script type="text/javascript" src="/dp/sites/all/modules/gmap/js/icon.js?Q"&#62;&#60;/script&#62;<br />
&#60;script type="text/javascript" src="/dp/sites/all/modules/gmap/js/markerloader_static.js?Q"&#62;&#60;/script&#62;</code></p>
<p>This could probably be put in a template.php function instead and added to the $scripts variable, but since I&#8217;m currently exploring the possibilities of combining Gmap Views with Taxonomy and Date/Calendar and not working on slim code I&#8217;ll leave it at that for now.</p>
<p>If these scripts shouldn&#8217;t work out&#8217;ve the box for you, open up a page-view of your Gmap and look in the source code there for what scripts are added and copy everything Gmap related to your .tpl file.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal 6 PHPUnit testing setup]]></title>
<link>http://kristiannissen.wordpress.com/2009/12/08/drupal-6-phpunit-testing-setup/</link>
<pubDate>Tue, 08 Dec 2009 12:36:03 +0000</pubDate>
<dc:creator>Kristian Nissen</dc:creator>
<guid>http://kristiannissen.wordpress.com/2009/12/08/drupal-6-phpunit-testing-setup/</guid>
<description><![CDATA[Using PHPUnit or PHPSpec when developing Drupal modules has some obvious benefits; you don&#8217;t h]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Using PHPUnit or PHPSpec when developing Drupal modules has some obvious benefits; you don&#8217;t have to reload you entire website in a browser each time you want to test your module.<!--more-->I have spent the last couple of months developing modules for Drupal 5 and 6 and I tend to spent too much time clearing the cache and the theme registry when using the hook_menu (). The problem is that you need to tell Drupal about the new menu item before you can call it, even in a test case.</p>
<p>If you want to use PHPUnit when developing Drupal modules, and if you want to have a folder structure where tests are not stored together with you actual modules &#8211; tests do not belong in any production environment &#8211; this guide will be helpful.</p>
<p>To make unit testing agnostic in Drupal you need to store your tests at the root level of your Drupal directory, I prefer this structure for my Drupal projects:</p>
<p>Root:<br />
- includes<br />
- misc<br />
- modules<br />
- profiles<br />
- scripts<br />
- sites<br />
- tests<br />
- themes<br />
&#8230;</p>
<p>Notice the &#8220;tests&#8221; folder in the root, that&#8217;s where all our PHPUnit tests will go.</p>
<p>To get this running you will need to include Drupal&#8217;s bootstrap inside your PHPUnit test case, and you can use the following set_include_path script:</p>
<pre>define('ROOT_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR));
set_include_path(ROOT_PATH
. PATH_SEPARATOR
. get_include_path()
);</pre>
<p>Now you can safely include the bootstrap.inc file located inside the includes folder in your root directory like so:</p>
<pre>include_once 'includes' . DIRECTORY_SEPARATOR . 'bootstrap.inc';</pre>
<p>and once that&#8217;s done, you can bootstrap the testcase:</p>
<pre>drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);</pre>
<p>That&#8217;s it, now your ready to use PHPUnit when developing Drupal modules, and to do so, cd into your root directory and execute the following PHPUnit code:</p>
<pre>phpunit ModuleTest tests/ModuleTest.php</pre>
<p>That&#8217;s it, enjoy.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal Unit testing using PHPSpec]]></title>
<link>http://kristiannissen.wordpress.com/2009/12/08/drupal-unit-testing-using-phpspec/</link>
<pubDate>Tue, 08 Dec 2009 12:13:57 +0000</pubDate>
<dc:creator>Kristian Nissen</dc:creator>
<guid>http://kristiannissen.wordpress.com/2009/12/08/drupal-unit-testing-using-phpspec/</guid>
<description><![CDATA[It took a couple of hours to get this up and running, but the following guidelines will help you set]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>It took a couple of hours to get this up and running, but the following guidelines will help you setup a PHPSpec based testing environment which uses the same conventions regarding folder structure like we know and love it from Rails and Zend.<!--more-->Tests should not be included together with your modules code, and they definitely do not belong in any production environment.</p>
<p>I like to have a separate folder at the root level of my Drupal installation for all my tests, and I hate having to use a certain testing framework when developing modules, Drupal should be testing framework agnostic, and using these simple guidelines, it should be possible.</p>
<p>This is the desired folder structure:</p>
<pre>Root:
- includes
- misc
- modules
- profiles
- scripts
- sites
- tests
- themes
...</pre>
<p>Notice the &#8220;tests&#8221; folder, that is where we will store all our tests, and you can use the following for both PHPSpec and PHPUnit.</p>
<p>PHPSpec setup for Drupal 6:</p>
<pre>define('ROOT_PATH', realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR));

set_include_path(ROOT_PATH
  . PATH_SEPARATOR
  . get_include_path()
);

include_once 'includes' . DIRECTORY_SEPARATOR . 'bootstrap.inc';

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

class DescribeGeoSegModule extends PHPSpec_Context {
  public function itShouldReturnHelloDushbagWhenMenuHookIsCalled () {
    $menu = file_get_contents("http://drupaltest.localhost/syndication");
    $this-&#62;spec(
      $menu == 'Hello Dushbag'
    )-&#62;should-&#62;beTrue();
  }
  public function itShouldReturnADrupalBlogWhenBlockHookIsCalled () {
    $module = module_invoke('dinbygeosegmod', 'block', 'view', 0);
    $this-&#62;spec(
      empty($module['content']) == false
    )-&#62;should-&#62;beTrue();
  }
}</pre>
<p>To execute the above test cd into you root dir and execute: <strong>phpspec -r tests/</strong> I have only tested the above on windows XP but since no directory separator has been used, it should work on any OS.</p>
<p>I&#8217;ll show you how to set this up in PHPUnit in a different post.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Disable upload and comment for a new content type programmatically]]></title>
<link>http://chirale.wordpress.com/2009/12/07/disable-upload-and-comment-for-a-new-content-type-programmatically/</link>
<pubDate>Mon, 07 Dec 2009 08:56:34 +0000</pubDate>
<dc:creator>chirale</dc:creator>
<guid>http://chirale.wordpress.com/2009/12/07/disable-upload-and-comment-for-a-new-content-type-programmatically/</guid>
<description><![CDATA[Following code is useful when installing a module that create a new content type programmatically on]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Following code is useful when installing a module that create a new content type programmatically on Drupal 6.x.</p>
<p>Basically, it adds two variables setting default values for comments (core Comment module) and attachments (core Upload module).</p>
<p>Code to write on <code>my_funny_module/my_funny_module.install</code>.</p>
<pre>function my_funny_module_install() {
  // Disable attachments
  // Read http://api.drupal.org/api/function/upload_nodeapi/6 on "load"
  variable_set("my_content_type", 0);

  // Disable comments for this content type
  // Read http://api.drupal.org/api/function/comment_form_alter/6
  variable_set('my_content_type', COMMENT_NODE_DISABLED);

  // Install schema as usual (if any)
  drupal_install_schema('my_funny_module');
}
</pre>
<p>Note that this code assign only <em>default</em> values for <em>my_content_type</em>: as any content type, this value could be later changed via GUI.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal 6 and hook_form_FORM_ID_alter]]></title>
<link>http://kristiannissen.wordpress.com/2009/10/26/drupal-6-and-hook_form_form_id_alter/</link>
<pubDate>Mon, 26 Oct 2009 13:18:23 +0000</pubDate>
<dc:creator>Kristian Nissen</dc:creator>
<guid>http://kristiannissen.wordpress.com/2009/10/26/drupal-6-and-hook_form_form_id_alter/</guid>
<description><![CDATA[Using hook_form_FORM_ID_alter makes it possible to hook into any drupal 6 form before it renders, th]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Using <a href="http://api.drupal.org/api/function/hook_form_FORM_ID_alter/6">hook_form_FORM_ID_alter</a> makes it possible to hook into any drupal 6 form before it renders, that way you can add fields or manipulate existing fields before the form is presented to the end user.<!--more-->Extending an existing form in a Drupal 6 website from within a module is easy once you&#8217;ve tried it a couple of times, but damn you can end up with some long function names. On <a href="http://www.rejseliv.dk">www.rejseliv.dk</a> I&#8217;m currently extending a module called &#8220;destinationtips&#8221;, and the form I&#8217;m trying to hook up with is called &#8220;destination_comment_node_form&#8221;, so to use hook_form_FORM_ID_alter I get a function called &#8220;function destinationtips_form_destination_comment_node_form_alter(&#38;$form, &#38;$form_state) {}&#8221;.</p>
<p>To access any field inside the existing form, I can now use <strong>$form['title']['#title'] = &#8216;Hello Dushbag&#8217;;</strong> If I want to extend it, add additional fields it can be done using something like:</p>
<p><code> $form['image'] = array(<br />
'#type' =&#62; 'textfield',<br />
'#title' =&#62; 'Hello Mom'<br />
);</code></p>
<p>and now I can add my own submit handler by adding <strong>$form['#submit'][] = &#8216;user_images_handler&#8217;;</strong> When the form is submitted my additional data can be handled from within <strong>function user_images_handler($form, $form_values)</strong>.</p>
<p>So if you are doing this from within a module, the syntax would be <strong>[destinationtips]_form_[destination_comment_node_form]_alter ()</strong> where:</p>
<ul>
<li><span style="background-color:#ffffff;">[destinationtips] is the name of the module</span></li>
<li><span style="background-color:#ffffff;">[destination_comment_node_form] is the form id which I want to manipulate</span></li>
</ul>
<p>You will need to get a <strong>form_id</strong>, you can get that by simply <strong>&#8220;inspecting&#8221;</strong> the form using chrome/safari developer or firebug, you should be looking for something like this:</p>
<p><img class="alignleft size-medium wp-image-297" title="drupal_form_id" src="http://kristiannissen.wordpress.com/files/2009/10/drupal_form_id.png?w=300" alt="Drupal form id" width="300" height="69" /></p>
<p>It took me a couple of hours to figure out how this all can be combined, so if it&#8217;s any help, knock yourself out.</p>
<p>If you don&#8217;t want to append your own submit handler like this: <strong>$form['#submit'][] = &#8216;user_images_handler&#8217;;</strong> you can use the submit hook instead like this: <strong>destination_comment_node_form_submit</strong>, the syntax is:</p>
<ul>
<li><span style="background-color:#ffffff;">[destination_comment_node_form]_submit</span></li>
</ul>
<p>- where destination_comment_node_form again is my form id.</p>
<p><strong>The complete code would then look something like this:</strong></p>
<pre>destinationtips_form_destination_comment_node_form_alter(&#38;$form, &#38;$form_state) {
// Alter the form here, add your custom fields
}
destination_comment_node_form_submit($form, &#38;$form_state) {
// Handle submit here
}</pre>
<p>- this is a great way to extend Drupals standard forms like the node_form since these are not accessible.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Video download problem in drupal 6]]></title>
<link>http://webcoding.wordpress.com/2009/10/22/video-download-problem-in-drupal-6/</link>
<pubDate>Thu, 22 Oct 2009 09:24:53 +0000</pubDate>
<dc:creator>slvramesh</dc:creator>
<guid>http://webcoding.wordpress.com/2009/10/22/video-download-problem-in-drupal-6/</guid>
<description><![CDATA[Problem: When am i trying to download video in drupal 6 (video module) its not working. I have to sp]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><strong>Problem: </strong></p>
<p>When am i trying to download video in drupal 6 (video module) its not working. I have to spend one hour and find the solution.</p>
<p><strong>Step 1:</strong></p>
<p>Replace the code line number 104 to 120 from the video.module file.</p>
<p>Old Code</p>
<p>if (arg(0) == &#8216;node&#8217; &#38;&#38; is_numeric(arg(1))) {<br />
if ($node = node_load(arg(1)) and $node-&#62;type == &#8216;video&#8217;) {</p>
<p>//enable the download tab only if it is supported<br />
if (video_support_download($node)) {</p>
<p>$menu_type = (variable_get(&#8216;video_displaydownloadmenutab&#8217;, 1)) ? MENU_LOCAL_TASK : MENU_CALLBACK;<br />
$items['node/'.$node-&#62;nid.'/download'] = array(<br />
&#8216;title&#8217; =&#62; &#8216;Download&#8217;,<br />
&#8216;page callback&#8217; =&#62; &#8216;video_download&#8217;,<br />
&#8216;page arguments&#8217; =&#62; array($node),<br />
&#8216;access arguments&#8217; =&#62; array(&#8216;access video&#8217;) &#38;&#38; node_access(&#8216;view&#8217;, $node, $user-&#62;uid),<br />
&#8216;weight&#8217; =&#62; 5,<br />
&#8216;type&#8217; =&#62; $menu_type);<br />
}<br />
}<br />
}</p>
<p>New Code:</p>
<p>$items['video/download/%node'] = array(<br />
&#8216;title&#8217; =&#62; &#8216;Download&#8217;,<br />
&#8216;page callback&#8217; =&#62; &#8216;video_download&#8217;,<br />
&#8216;page arguments&#8217; =&#62; array(2),<br />
&#8216;access arguments&#8217; =&#62; array(&#8216;access video&#8217;),<br />
&#8216;type&#8217; =&#62; MENU_CALLBACK);</p>
<p><strong>Step 2:</strong></p>
<p>Replace the menu link cod, Find the below code from video.module file</p>
<p>&#8216;href&#8217; =&#62; &#8220;node/$node-&#62;nid/download&#8221;,</p>
<p>and replace the below code</p>
<p>&#8216;href&#8217; =&#62; &#8220;video/download/%node&#8221;,</p>
<p>Now remove the cache file from your drupal site using the admin user.</p>
<p>Now its working fine.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[how db_query_range function works in drupal 6]]></title>
<link>http://ctx2002.wordpress.com/2009/10/21/how-db_query_range-function-works-in-drupal-6/</link>
<pubDate>Wed, 21 Oct 2009 09:06:06 +0000</pubDate>
<dc:creator>ctx2002</dc:creator>
<guid>http://ctx2002.wordpress.com/2009/10/21/how-db_query_range-function-works-in-drupal-6/</guid>
<description><![CDATA[$ancestors is array which contains following value array 0 =&gt; string 'admin/content' (length=13) ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>$ancestors is array which contains following value</p>
<pre><strong>array</strong>
  0 <span style="color:#888a85;">=&#62;</span> string <span style="color:#cc0000;">'admin/content'</span> <em>(length=13)</em>
  1 <span style="color:#888a85;">=&#62;</span> string <span style="color:#cc0000;">'admin/%'</span> <em>(length=7)</em>
  2 <span style="color:#888a85;">=&#62;</span> string <span style="color:#cc0000;">'admin'</span> <em>(length=5)</em>

$placeholders is an array which contains following value
<pre><strong>array</strong>
  0 <span style="color:#888a85;">=&#62;</span> string <span style="color:#cc0000;">''%s''</span> <em>(length=4)</em>
  1 <span style="color:#888a85;">=&#62;</span> string <span style="color:#cc0000;">''%s''</span> <em>(length=4)</em>
  2 <span style="color:#888a85;">=&#62;</span> string <span style="color:#cc0000;">''%s''</span> <em>(length=4)</em>
</pre>
<p>db_query_range('SELECT * FROM {menu_router} WHERE path IN ('. implode (',', $placeholders) .') ORDER BY fit DESC', $ancestors, 0, 1);</p>
<p>the final query will be executed is :<br />
SELECT * FROM menu_router WHERE path IN</p>
<p>('admin/content','admin/%','admin') ORDER BY fit DESC LIMIT 0, 1,</p>
<p>so from here we can see, 0 and 1<br />
passed into db_query_range becomes mysql limit 0, 1.</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Pt. 2: Membuat menu di custom module Drupal 6]]></title>
<link>http://ojat.wordpress.com/?p=24</link>
<pubDate>Thu, 24 Sep 2009 14:22:01 +0000</pubDate>
<dc:creator>ojat</dc:creator>
<guid>http://ojat.wordpress.com/?p=24</guid>
<description><![CDATA[Ada 5 (lima) tipe menu yang bisa dipakai ketika membuat menu pada custom module Drupal 6 dengan meng]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Ada 5 (lima) tipe menu yang bisa dipakai ketika membuat menu pada custom module Drupal 6 dengan menggunakan hook_menu(), yaitu MENU_NORMAL_ITEM, MENU_CALLBACK, MENU_DEFAULT_LOCAL_TASK, MENU_LOCAL_TASK, dan MENU_SUGGESTED_ITEM. Masing-masing punya kegunaan sendiri-sendiri (lihat <a href="http://api.drupal.org/api/function/hook_menu/6">http://api.drupal.org/api/function/hook_menu/6</a> untuk penjelasan lebih lanjut). Kali ini saya coba membuat contoh untuk masing-masing menu tersebut.<!--more--></p>
<p>Pertama kita buat dulu module drupalnya. Buat folder (untuk custom module kali ini saya pakai nama MyModule) mymodule di folder <em><strong>&#60;drupal installation root&#62;\Sites\drupal\sites\all\modules</strong></em>.</p>
<p style="text-align:center;"><img class="size-full wp-image-25 aligncenter" title="buat folder module" src="http://ojat.wordpress.com/files/2009/09/4.jpg" alt="buat folder module" width="192" height="101" /></p>
<p>Lalu buat 2 (dua) buah file yaitu &#60;nama module&#62;.info dan &#60;nama module&#62;.module. Pada tulisan kali ini saya buat <em><strong>mymodule.info</strong></em> dan <em><strong>mymodule.module</strong></em>.</p>
<p style="text-align:center;"><img class="size-full wp-image-26 aligncenter" title="membuat file module" src="http://ojat.wordpress.com/files/2009/09/5.jpg" alt="membuat file module" width="290" height="105" /></p>
<p>Buka mymodule.info dengan menggunakan text editor favorite anda (kebetulan saya pakai <a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a>), lalu ketik dan simpan code berikut:</p>
<pre>name = My Module
description = This is my custom module named My Module
core = 6.x</pre>
<p>Kemudian buka file mymodule.module untuk memulai coding custom module kali ini. Sebagai permulaan, ketikkan kode berikut pada file mymodule.module:</p>
<pre class="brush: php;">

&#38;lt;?php

function mymodule_perm() {
return array('access mymodule', 'administer mymodule');
}
</pre>
<h4>MENU_NORMAL_ITEM</h4>
<p>Seperti pada tulisan sebelumnya, MENU_NORMAL_ITEM adalah menu standar yang tampil pada blok navigasi. Menu ini bisa dibuat sendiri-sendiri atau nested. Contoh kode:</p>
<pre class="brush: php;">
...

function mymodule_menu() {
$items['normal-item'] = array(
'title' =&#38;gt; t('Menu Normal Item'),
'page callback' =&#38;gt; 'mymodule_function_1',
'access arguments' =&#38;gt; array('access mymodule'),
'type' =&#38;gt; MENU_NORMAL_ITEM
);

$items['normal-item/child-1'] = array(
'title' =&#38;gt; t('Child 1'),
'page callback' =&#38;gt; 'mymodule_function_child_1',
'access arguments' =&#38;gt; array('access mymodule'),
'type' =&#38;gt; MENU_NORMAL_ITEM
);

return $items;
}

function mymodule_function_1() {
return 'Hello from mymodule_function_1';
}

function mymodule_function_child_1() {
return 'Hello from mymodule_function_child_1';
}

...
</pre>
<p>Pada kode diatas, saya membuat 2 (dua) buah menu dengan tipe MENU_NORMAL_ITEM. Menu pertama menjadi parent dari menu kedua dan masing-masing menu memanggil <em>function PHP </em>yang dapat menjalankan tugas-tugas tertentu. Jika kita aktifkan <em>mymodule</em>, maka menu tersebut akan muncul secara otomatis di blok navigasi Drupal. Untuk user selain administrator, aktifkan permission <strong><em>access mymodule</em></strong> agar user tersebut dapat melihat menu ini.</p>
<p style="text-align:center;"><img class="size-full wp-image-33 aligncenter" title="6" src="http://ojat.wordpress.com/files/2009/09/6.jpg" alt="6" width="174" height="79" /></p>
<p style="text-align:center;"><img class="size-full wp-image-34 aligncenter" title="7" src="http://ojat.wordpress.com/files/2009/09/7.jpg" alt="7" width="275" height="111" /></p>
<p style="text-align:center;"><img class="size-full wp-image-35 aligncenter" title="8" src="http://ojat.wordpress.com/files/2009/09/8.jpg" alt="8" width="282" height="115" /></p>
<h4>MENU_CALLBACK</h4>
<p>Hampir sama dengan MENU_NORMAL_ITEM, menu dengan tipe MENU_CALLBACK juga digunakan untuk memanggil fungsi-fungsi tertentu pada custom module. Perbedaannya adalah, MENU_CALLBACK tidak muncul secara otomatis di blok navigasi. Menu ini dapat diakses dengan menuliskan URL pada address bar browser.</p>
<p>Buat newbie seperti saya, biasanya MENU_CALLBACK saya pakai kalau saya ingin mengakses fungsi-fungsi pada module yang membutuhkan parameter. Kode berikut mungkin bisa menunjukkan bagaimana penggunaan MENU_CALLBACK:</p>
<pre class="brush: php;">

...

$items['callback-item-1'] = array(
'title' =&#38;gt; t('Menu Callback Item 1'),
'page callback' =&#38;gt; 'mymodule_callback_function',
'access arguments' =&#38;gt; array('access mymodule'),
'type' =&#38;gt; MENU_CALLBACK
);

...

function mymodule_callback_function() {
return 'Hello from callback menu';
}

...
</pre>
<p>Untuk mengakses menu tersebut, ketikkan URL menu tersebut pada address bar browser. Asumsi Drupal diakses di <em>http://localhost/drupal</em>, maka untuk mengakses menu diatas dapat mengetikkan <em>http://localhost/drupal/callback-item-1</em>.</p>
<p style="text-align:center;"><img class="size-full wp-image-39 aligncenter" title="callback1" src="http://ojat.wordpress.com/files/2009/09/callback1.jpg" alt="callback1" width="268" height="38" /></p>
<p style="text-align:center;"><img class="size-full wp-image-40 aligncenter" title="callback2" src="http://ojat.wordpress.com/files/2009/09/callback2.jpg" alt="callback2" width="230" height="106" /></p>
<p>Contoh berikutnya adalah menu callback dengan parameter. Pada kode berikut ini saya akan membuat sebuah form untuk memasukkan nama yang kemudian nanti akan ditampilkan dengan menggunakan menu callback. Untuk mengakses form, saya membuat 1 (satu) menu normal dengan URL normal-item-2.</p>
<p>Pertama, buat menu normal untuk mengakses form dan menu callback untuk menampilkan sebuah halaman.</p>
<pre class="brush: php;">

...

$items['normal-item-2'] = array(
'title' =&#38;gt; t('Menu Normal Item 2'),
'page callback' =&#38;gt; 'drupal_get_form',
'page arguments' =&#38;gt; array('mymodule_callback_form'),
'access arguments' =&#38;gt; array('access mymodule'),
'type' =&#38;gt; MENU_NORMAL_ITEM
);

$items['callback-item-2/%'] = array(
'title' =&#38;gt; t('Hello'),
'page callback' =&#38;gt; 'mymodule_say_hi',
'access arguments' =&#38;gt; array('access mymodule'),
'type' =&#38;gt; MENU_CALLBACK
);

...
</pre>
<p>Lalu buat fungsi untuk menampilkan form.</p>
<pre class="brush: php;">

...

function mymodule_callback_form() {
$form['nama'] = array(
'#type' =&#38;gt; 'textfield',
'#title' =&#38;gt; t('Type your name please'),
'#description' =&#38;gt; t('E.g. Ekajati Winarmo'),
'#required' =&#38;gt; TRUE
);

$form['submit'] = array(
'#type' =&#38;gt; 'submit',
'#value' =&#38;gt; t('Say Hi!')
);

return $form;
}

function mymodule_callback_form_submit($form, &#38;amp;$form_state) {
$form_state['redirect'] = 'callback-item-2/'. $form_state['values']['nama'];
}

...
</pre>
<p>Setelah itu buat fungsi untuk menampilkan parameter dari form yang telah dibuat diatas.</p>
<pre class="brush: php;">

...

function mymodule_say_hi() {
return 'Hi, ' . arg(1). ', welcome to Drupal 6';
}

...
</pre>
<p>Simpan kode diatas, lalu akses menu-normal-item-2. Bila menu belum muncul, clear dulu cache website dengan mengakses <strong>http://&#60;drupal root&#62;/admin/settings/performance</strong> dan klik tombol <em>clear cache</em>.</p>
<p>Bila menu-normal-item-2 diakses, maka Drupal akan menampilkan sebuah form dengan 1 (satu) buah textfield dan 1 (satu) buah tombol. Bila tombol di-klik, maka Drupal secara akan menampilkan halaman salam. Tanda % pada menu callback digunakan untuk menampung variable dari form. Sedangkan arg(1) digunakan untuk mengakses variable pada URL.</p>
<p style="text-align:center;"><img class="size-full wp-image-38 aligncenter" title="callback" src="http://ojat.wordpress.com/files/2009/09/callback.jpg" alt="callback" width="356" height="70" /></p>
<p style="text-align:center;"><img class="size-full wp-image-42 aligncenter" title="normal-item2" src="http://ojat.wordpress.com/files/2009/09/normal-item2.jpg" alt="normal-item2" width="259" height="33" /></p>
<p style="text-align:center;"><img class="size-full wp-image-43 aligncenter" title="form-say-hi" src="http://ojat.wordpress.com/files/2009/09/form-say-hi1.jpg" alt="form-say-hi" width="432" height="209" /></p>
<p>Bila tombol Say Hi! ditekan, maka Drupal akan menampilkan halaman seperti screenshot berikut.</p>
<p style="text-align:center;"><img class="size-full wp-image-44 aligncenter" title="hello-ojat" src="http://ojat.wordpress.com/files/2009/09/hello-ojat.jpg" alt="hello-ojat" width="233" height="90" /></p>
<p style="text-align:center;">
<h4>MENU_DEFAULT_LOCAL_TASK &#38; MENU_LOCAL_TASK</h4>
<p>Menu tipe ini biasanya digunakan berpasangan. MENU_LOCAL_TASK digunakan untuk menampilkan menu dengan bentuk tab seperti contoh gambar berikut:</p>
<p style="text-align:center;"><img class="size-full wp-image-53 aligncenter" title="localtaskmenu" src="http://ojat.wordpress.com/files/2009/09/localtaskmenu.jpg" alt="localtaskmenu" width="238" height="76" /></p>
<p>Ketika MENU_LOCAL_TASK digunakan sebagai menu, maka wajib ada satu menu default. Menu default ini menggunakan tipe MENU_DEFAULT_LOCAL_TASK dimana menu ini dengan tipe ini memiliki path yang sama dengan parent menu. Pada gambar diatas, View adalah menu default di menu My Account. Jadi ribet nih jelasinnya <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  hehe mendingan liat contoh kode berikut:</p>
<pre class="brush: php;">

...

$items['menu-tab'] = array(
 'title' =&#38;gt; t('Tabbed menu'),
 'page callback' =&#38;gt; 'mymodule_tabbed_menu',
 'access arguments' =&#38;gt; array('access mymodule'),
 'type' =&#38;gt; MENU_NORMAL_ITEM
 );

 $items['menu-tab/view'] = array(
 'title' =&#38;gt; t('Tabbed menu'),
 'type' =&#38;gt; MENU_DEFAULT_LOCAL_TASK,
 'weight' =&#38;gt; 0
 );

 $items['menu-tab/admin'] = array(
 'title' =&#38;gt; t('Administer'),
 'page callback' =&#38;gt; 'mymodule_tabbed_admin',
 'access arguments' =&#38;gt; array('access mymodule'),
 'type' =&#38;gt; MENU_LOCAL_TASK,
 'weight' =&#38;gt; 1
 );

...

function mymodule_tabbed_menu() {
 return 'Hello from tabbed menu';
}

function mymodule_tabbed_admin() {
 return 'Hello from admin tabbed menu';
}
</pre>
<p>Kode diatas akan menghasilkan tampilan seperti berikut ini:</p>
<p style="text-align:center;"><img class="size-full wp-image-54 aligncenter" title="tabbed" src="http://ojat.wordpress.com/files/2009/09/tabbed.jpg" alt="tabbed" width="384" height="131" /></p>
<p>Tampak Tabbed Menu otomatis terpilih sebagai default menu.</p>
<h4>MENU_SUGGESTED_ITEM</h4>
<p>Tipe menu ini hampir sama dengan MENU_NORMAL_ITEM. Perbedaannya adalah kalau MENU_NORMAL_ITEM akan muncul secara otomatis di blok navigasi, maka MENU_SUGGESTED_ITEM secara default disabled atau non-aktif. Menu tipe ini dapat diaktifkan atau enabled oleh admin (atau user yang memiliki hak) melalui halaman administer.</p>
<pre class="brush: php;">

...

$items['suggested-item'] = array(
 'title' =&#38;gt; t('This is suggested menu'),
 'page callback' =&#38;gt; 'mymodule_suggested_item',
 'access arguments' =&#38;gt; array('access mymodule'),
 'type' =&#38;gt; MENU_SUGGESTED_ITEM
 );

...

function mymodule_suggested_item() {
 return 'Hello from suggested menu';
}

...
</pre>
<p>Menu tersebut akan tampak pada halaman administrasi menu (administer-&#62;site building-&#62;menu-&#62;navigation) seperti pada gambar berikut:</p>
<p style="text-align:center;"><img class="size-full wp-image-55 aligncenter" title="suggested-item" src="http://ojat.wordpress.com/files/2009/09/suggested-item.jpg" alt="suggested-item" width="373" height="144" /></p>
<p>Yup, itu tadi cara membuat menu di custom module Drupal 6. Kalo ada kode-kode yang kurang efisien atau salah mohon dikoreksi soalnya saya juga masih newbie di Drupal <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Semoga bermanfaat.</p>
<p>Referensi: <a href="http://api.drupal.org">http://api.drupal.org</a></p>
<p>Full source code download <a href="http://www.box.net/shared/kfjegf7az7">di sini</a>.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Membuat menu di custom module Drupal 6]]></title>
<link>http://ojat.wordpress.com/?p=8</link>
<pubDate>Thu, 24 Sep 2009 01:33:36 +0000</pubDate>
<dc:creator>ojat</dc:creator>
<guid>http://ojat.wordpress.com/?p=8</guid>
<description><![CDATA[Cara membuat menu di custom module Drupal versi 6 (asumsi nama module = ojat). &amp;lt;?php // pakai]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Cara membuat menu di custom module Drupal versi 6 (asumsi nama module = ojat).</p>
<pre class="brush: php;">

&#38;lt;?php

// pakai hook_menu()
function ojat_menu() {
// menuku adalah bagian dari URL untuk
// mengakses module -&#38;gt; e.g. http://localhost/menuku
$items['menuku'] = array(
// teks yang tampil di block navigasi
'title' =&#38;gt; t('This is my menu'),
// page callback digunakan untuk memanggil fungsi dalam module
'page callback' =&#38;gt; 'my_function',
// access arguments digunakan untuk membatasi siapa saja yang dapat mengakses menu ini
'access arguments' =&#38;gt; array('view ojat'),
// type, MENU_NORMAL_ITEM, menu standar yang tampil di block navigasi
'type' =&#38;gt; MENU_NORMAL_ITEM
);

$items['menu-lainnya'] = array(
'title' =&#38;gt; t('This is my other menu'),
'page callback' =&#38;gt; 'my_another_function',
'access arguments' =&#38;gt; array('view ojat'),
'type' =&#38;gt; MENU_NORMAL_ITEM
);

return $items;
}

// array of permissions
function ojat_perm() {
return array('view ojat', 'administer ojat');
}

// fungsi dalam module
function my_function() {
return t('Hello from my_function');
}
</pre>
<p>Simpan, lalu aktifkan module.</p>
<p style="text-align:center;"><img class="size-full wp-image-13 aligncenter" title="aktifkan module" src="http://ojat.wordpress.com/files/2009/09/1.jpg" alt="aktifkan module" width="404" height="144" /></p>
<p>Hasilnya bisa dilihat di screen shot berikut.</p>
<p style="text-align:center;"><img class="size-full wp-image-14 aligncenter" title="menu " src="http://ojat.wordpress.com/files/2009/09/2.jpg" alt="menu " width="225" height="69" /></p>
<p style="text-align:center;"><img class="aligncenter size-full wp-image-15" title="3" src="http://ojat.wordpress.com/files/2009/09/3.jpg" alt="3" width="228" height="134" /></p>
<p style="text-align:left;">Terkadang kita ingin membuat nested menu, misalnya dengan hirarki sebagai berikut:</p>
<p style="text-align:left;">&#124;- top-menu<br />
&#124;&#8212;- menu-1<br />
&#124;&#8212;- menu-2<br />
&#124;&#8212;- &#8212;- child-of-menu-2<br />
&#124;&#8212;- menu-3</p>
<p style="text-align:left;">Nah, caranya mudah, cukup dengan mengatur key pada variable menu. Pada contoh diatas, bisa dituliskan sebagai berikut:</p>
<pre class="brush: php;">
...

$items['top-menu'] = array(...);
$items['top-menu/menu-1'] = array(...);
$items['top-menu/menu-2'] = array(...);
$items['top-menu/menu-2/child-of-menu-2'] = array(...);

...
</pre>
<p style="text-align:left;">Referensi: <a href="http://api.drupal.org/api/function/hook_menu/6">http://api.drupal.org/api/function/hook_menu/6</a></p>
<p style="text-align:left;">Salam dari newbie <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Theme a multiple CCK field with a table]]></title>
<link>http://chirale.wordpress.com/2009/08/06/theme-a-multiple-cck-field-with-a-table/</link>
<pubDate>Thu, 06 Aug 2009 07:52:31 +0000</pubDate>
<dc:creator>chirale</dc:creator>
<guid>http://chirale.wordpress.com/2009/08/06/theme-a-multiple-cck-field-with-a-table/</guid>
<description><![CDATA[Sometimes CCK contrib modules cannot do exactly what you want. It&#8217;s time to build your custom ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Sometimes CCK contrib modules cannot do exactly what you want. It&#8217;s time to build your custom CCK field!</p>
<p>Official documentation on CCK fields creation for Drupal 6 is incomplete and some passages are obscure. If there is a good howto you have to read before do any CCK customization, this is <a href="http://www.lullabot.com/articles/creating-custom-cck-fields" target="_blank">Creating Custom CCK Fields</a>. This howto supposes you&#8217;ve read and understand it before continue. If you want to create a custom field, you can read the complete<a href="http://www.poplarware.com/cckfieldmodule.html" target="_blank"> Creating a Compound field</a>. A custom multiple compound field (with more than one field for element, e.g. an image and its description).</p>
<p><em>Read these howto well, you&#8217;ll spare time later<br />
</em></p>
<p>Well, you have followed the howto, you have your own compound field but now you have a problem. You want to display compound field data as cells in a table, and each field as row.</p>
<p>On following example, we have a name list made with a multiple compound field with &#8220;firstname&#8221; and &#8220;lastname&#8221; columns.</p>
<p>KarenS tell you that you&#8217;ve to use CONTENT_HANDLE_MODULE instead of CONTENT_HANDLE_CORE on hook_formatter_info() .</p>
<pre>// The machine name of the formatter.
function my_funny_module_field_formatter_info() {
  return array(
    'default' =&#62; array(
      'label' =&#62; t('Default'),
      // An array of the field types this formatter
      // can be used on.
      'field types' =&#62; array('examplefield'),
      // CONTENT_HANDLE_CORE:   CCK will pass the formatter
      // a single value.
      // CONTENT_HANDLE_MODULE: CCK will pass the formatter
      // an array of all the values. None of CCK's core
      // formatters use multiple values, that is an option
      // available to other modules that want it.
      'multiple values' =&#62; CONTENT_HANDLE_MODULE,
    ),
  );
}

/** Set the formatter **/
function my_funny_module_theme() {
  return array(
    'my_funny_module_formatter_default' =&#62; array(
      'arguments' =&#62; array('element' =&#62; NULL),
      'function' =&#62; 'funny_display_table',
    ),
  );
}

/** Here you format your table data as array **/
function my_funny_module_formatter_default($element) {
  $data = array(
      $element['#item']['firstname'],
      $element['#item']['lastname'],
  );
  return $data;
}

/** This function will display a table even where data array is empty:
 ** You have to put an additional control statement to avoid this.
 ** $element will have $data from formatter_default() above
 **/
function my_funny_module_display_table($element) {
  $header = array(
    t('First name'),
    t('Last name'),
  );
  $i = 0;
  while (!$end) {
    /** Any row will contains **/
    if(array_key_exists($i, $element)) {
      $rows[] = array(
        'firstname' =&#62; $element[$i]['#item']['firstname'],
        'lastname' =&#62;$element[$i]['#item']['lastname'],
      );
      $i++;
    }
    else {
      $end = TRUE;
    }
  }
  /** Theme a table with data from element and header **/
  return theme('table', $header, $rows);
}</pre>
<p><strong>N</strong><strong>ote: </strong>to format a table you have to change only &#8220;multiple values&#8221; on my_funny_module_field_formatter_info(): you can leave my_funny_module_widget_info() as is.</p>
<p><strong>See also:</strong></p>
<ul>
<li><a href="http://www.lullabot.com/articles/creating-custom-cck-fields" target="_blank">Creating Custom CCK Fields &#8211; a stunning howto by  KarenS (Lullabot)</a></li>
<li><a href="http://www.poplarware.com/cckfieldmodule.html">Creating a compound Field Module by Jennifer H.</a> &#8211; a complete howto</li>
<li><a href="http://api.drupal.org/api/function/theme_table/6" target="_blank">theme_table() function</a> &#8211; how to tranform an array of data into a table, drupal way</li>
</ul>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Add CSS style for a block into the same block]]></title>
<link>http://chirale.wordpress.com/2009/07/29/add-css-style-for-a-block-into-the-same-block/</link>
<pubDate>Wed, 29 Jul 2009 17:00:01 +0000</pubDate>
<dc:creator>chirale</dc:creator>
<guid>http://chirale.wordpress.com/2009/07/29/add-css-style-for-a-block-into-the-same-block/</guid>
<description><![CDATA[This simple code can be pasted into a PHP filtered block (or into a block declared by a module) to s]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>This simple code can be pasted into a PHP filtered block (or into a block declared by a module) to set some style from a block into the block container itself.</p>
<pre>&#60;?php
echo 'My block content';
/** Put styles inline on html head**/
drupal_set_html_head('&#60;style type="text/css"&#62;
#my-block-id {
  /* my style*/
}
&#60;/style&#62;
');
?&#62;</pre>
<p>This code is placed on html head, applied only to the pages where block appears, without touching css optimization. If you want to include an external CSS file instead, use <a href="http://api.drupal.org/api/function/drupal_add_css/6">drupal_add_css</a> instead: in any case you can exclude this file for aggregation, setting $preprocess attribute to FALSE.</p>
<p>If block appears in very few pages, and it can change quickly (e.g. a banner with custom styles on home page), using <strong>drupal_set_html_head</strong> could be the best way, even according to <a href="http://developer.yahoo.com/performance/rules.html#external">Yahoo Performance Best Practices</a>. In other cases, use <strong>drupal_add_css</strong>.</p>
<p><strong>See also:</strong></p>
<ul>
<li><a href="http://api.drupal.org/api/function/drupal_set_html_head/6">drupal_set_html_head</a></li>
<li><a href="http://api.drupal.org/api/function/drupal_add_css/6">drupal_add_css</a></li>
<li><a href="http://developer.yahoo.com/performance/rules.html#external">Make Javascript and CSS External (Yahoo Performance Best Practices)</a></li>
</ul>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Cron cannot run on Drupal: the drupal_goto() case]]></title>
<link>http://chirale.wordpress.com/2009/07/10/cron-cannot-run-on-drupal-the-drupal_goto-case/</link>
<pubDate>Fri, 10 Jul 2009 11:04:29 +0000</pubDate>
<dc:creator>chirale</dc:creator>
<guid>http://chirale.wordpress.com/2009/07/10/cron-cannot-run-on-drupal-the-drupal_goto-case/</guid>
<description><![CDATA[Sometimes you want to redirect a page to another on drupal. You can do this using a simple function ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Sometimes you want to redirect a page to another on drupal. You can do this using a simple function called <a href="http://api.drupal.org/api/function/drupal_goto/6" target="_blank">drupal_goto()</a>.</p>
<p>On few sites I&#8217;ve enabled the <strong>PHP filter</strong> module and then created a new page with PHP code input format with drupal_goto(&#8216;node/2&#8242;) to redirect the current page to a specified node. <strong>Bad idea</strong>.</p>
<p>I&#8217;ve noticed that, after this change, cron.php operations failed, if you have <strong>Search</strong> module enabled. On cron new contents are indexed by the Search module: when it got my PHP page, it tries to index it but suddenly is redirected to another. You can also found an error like &#8220;Maximum function nesting level of &#8216;100&#8242; reached&#8221; on php error log, symptom of an indexing blocked by pages with drupal_goto inside.</p>
<p><strong>Solution</strong>:</p>
<ol>
<li>Comment all drupal_goto() instruction in your site within pages.</li>
<li>Use an alternative method to redirect from a node to another.</li>
<li>Run cron from <strong>Status Report</strong> page: you can adjust indexed content per cron on Search configuration page (admin/settings/search on 6.x)</li>
</ol>
<p>You can add a new block with PHP code inside or (better) create a new module for this simple block (with a simple PHP switch statement as content),<strong> displaying it only on specified pages</strong> (on the bottom of block configuration). But if you create a PHP block via UI, and you put that block on every page, your site could be loop, so creating a module is the cleanest and secure way (if something go wrong, you can delete your module from the codebase and correct it). You can also find some contrib modules for redirect on <a href="http://drupalmodules.com" target="_blank">drupalmodules.com</a>.</p>
<p>See also:</p>
<ul>
<li> <a href="http://drupal.org/node/471698" target="_blank">Fatal error: Maximum function nesting level of &#8216;100&#8242; reached, aborting!</a> &#8211; an identical issue on drupal.org</li>
<li><a href="http://api.drupal.org/api/function/drupal_goto/6" target="_blank">drupal_goto() function (Drupal 6.x)</a></li>
</ul>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:395px;width:1px;height:1px;">
<h1 class="title node-type-project_issue">Fatal error: Maximum function nesting level of &#8216;100&#8242; reached, aborting!</h1>
</div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal 6, AJAX using jQuery]]></title>
<link>http://mimeblog.wordpress.com/2009/06/05/drupal-6-ajax-using-jquery/</link>
<pubDate>Fri, 05 Jun 2009 11:07:11 +0000</pubDate>
<dc:creator>Mike</dc:creator>
<guid>http://mimeblog.wordpress.com/2009/06/05/drupal-6-ajax-using-jquery/</guid>
<description><![CDATA[A quick tutorial on how to use jQuery to fetch results through AJAX with Drupal 6. The intended audi]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>A quick tutorial on how to use jQuery to fetch results through AJAX with Drupal 6. The intended audience is Drupal 6 module developers.</p>
<p>In this tutorial I placed the jQuery code in the hook_view function of my module. Lets begin with the code that creates the form and the jQuery script that call the AJAX function/URL,<!--more--></p>
<pre class="brush: php;">
global $theme;
$themePath = drupal_get_path ( 'theme', $theme );

// Create a ajax loder named ajax-loader-gif and place it in the current themes images folder.
$loaderUrl = url ( $themePath . '/images/ajax-loader.gif', array ('absolute' =&gt; TRUE) );
$ajaxLoaderImage = &quot;&lt;img src=\&quot;$loaderUrl\&quot; height=32 width=32 &gt;&quot;;
$url = 'http://' . $_SERVER ['SERVER_NAME'];

// The button that makes the AJAX call on click
$form['buttonId'] = array(
  '#value' =&gt; t('Fetch Node'),
  '#type' =&gt; 'button',
  '#id' =&gt; 'buttonId',
);

// Making the node nid a hidden field
$form['node_nid'] = array(
  '#type' =&gt; 'hidden',
  '#value' =&gt; $node-&gt;nid,
  '#id' =&gt; 'node_nid',
);

// Will show the node title here on AJAX fetch
$form['nodeTitle'] = array(
  '#type' =&gt; 'item',
  '#title' =&gt; t('Node title'),
  '#value' =&gt; '
&lt;div id=&quot;nodeTitle&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;nodeTitleMessage&quot;&gt;&lt;/div&gt;
',
);

// Will show the node body here on AJAX fetch
$form['nodeBody'] = array(
 '#type' =&gt; 'item',
 '#title' =&gt; t('Node title'),
 '#value' =&gt; '
&lt;div id=&quot;nodeBody&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;nodeBodyMessage&quot;&gt;&lt;/div&gt;
',
);

// Create some jQuery to fetch AJAX
$js = &quot;
  $(document).ready(function() {
    $('#buttonId').bind('click', function() {
      var nodeNid   = $('#node_nid').val();
      var url = '$url/fetch/ajax'+nodeNid;

      // We could have fetched the whoel node on one go, but I want to show that you can call $.get multiple times...
      $('#nodeTitle').hide();
      $('#nodeTitle').html('$ajaxLoaderImage');
      $('#nodeTitle').fadeIn(2000);
      var titleUrl = url + '/title';
      $.get(titleUrl, null, ajaxTitleDetails);

      $('#nodeBody').hide();
      $('#nodeBody').html('$ajaxLoaderImage');
      $('#nodeBody').fadeIn(2000);
      var bodyUrl = url + '/body';
      $.get(bodyUrl, null, ajaxBodyDetails);

      var ajaxTitleDetails = function(data) {
        var result = Drupal.parseJson(data);
        $('#nodeTitle').html(result['title']);
        $('#nodeTitleMessage').html(result['title_message']);
        $('#nodeTitle').fadeIn(3000);
        $('#nodeTitleMessage').fadeIn(3000);
      }

      var ajaxBodyDetails = function(data) {
        var result = Drupal.parseJson(data);
        $('#nodeBody').html(result['body']);
        $('#nodeBodyMessage').html(result['body_message']);
        $('#nodeBody').fadeIn(3000);
        $('#nodeBodyMessage').fadeIn(3000);
      }
    });
  });
&quot;; // End $js

drupal_add_js($js, 'inline', 'footer');
</pre>
<p>Next we need to create a menu item in the hook_menu function to say that we have a URL that creates our AJAX http://www.example.com/fetch/ajax/%/%.</p>
<pre class="brush: php;">
function examplemodule_menu() {
  $items = array();

  $items['fetch/ajax/%/%'] = array(
    'page callback' =&gt; 'get_ajax_node',
    'page arguments' =&gt; array(2,3),
    'type' =&gt; MENU_CALLBACK,
    'access arguments' =&gt; array('access content'),
  );

  return $items;
}
</pre>
<p>Okay, let&#8217;s create the function that delivers the AJAX content.</p>
<pre class="brush: php;">
function get_ajax_node($nid, $whatToFetch) {
  if( is_numeric($nid) ) {
    $node = node_load($nid);
    $sql = '';

    switch($whatToFetch) {
      case 'body':
      $sql = &quot;SELECT body FROM {node_revisions} nrv
                INNER JOIN {node} n ON n.vid = nrv.vid
                WHERE n.vid = %d&quot;;
      break;

      case 'title':
      default:
      $sql = &quot;SELECT title FROM {node_revisions} nrv
                INNER JOIN {node} n ON n.vid = nrv.vid
                WHERE n.vid = %d&quot;;
      break;
    }

    $dbObj = db_fetch_object( db_query($sql, $node-&gt;vid) );

    // Perhaps you want to show a debug message, then you just have to set it here...
    $message = '';

    print drupal_to_js(
      array(
        $whatToFetch     =&gt; $dbObj-&gt;$whatToFetch,
        $whatToFetch.'_message'  =&gt; $message,
      )
    );
  }
  exit();
}
</pre>
<p>Note: I have not tried this actual code (I&#8217;ve used a similar code), but I think it should work.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal 6 and admin settings]]></title>
<link>http://kristiannissen.wordpress.com/2009/05/21/drupal-6-and-admin-settings/</link>
<pubDate>Thu, 21 May 2009 06:37:45 +0000</pubDate>
<dc:creator>Kristian Nissen</dc:creator>
<guid>http://kristiannissen.wordpress.com/2009/05/21/drupal-6-and-admin-settings/</guid>
<description><![CDATA[I have been hacking away on Drupal 5 for the last couple of weeks since I got the gig at Berlingske.]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have been hacking away on Drupal 5 for the last couple of weeks since I got the gig at Berlingske.dk where I&#8217;m working on several of their sites, most of these were build when Drupal 5 was the latest and greatest, but yesterday I decided to take Drupal 6 for a spin, I thougth it would be a good time since Drupal 7 is just around the corner.<!--more-->One of the great things I discovered was this little darling: <strong>system_settings_form($form)</strong>. If you are writing a module and you want to save data in the variable table, don&#8217;t run your own settings form submit handler function, use system_settings_form instead, <strong>Drupal 6 will dissect your form and store the data accordingly</strong>, so the only thing you need to worry about is writing the validation.</p>
<p>Here is a small example:</p>
<pre>function node_nodes_admin_settings($form_state) {
 $form['node_nodes_types'] = array(
 '#type' =&#62; 'checkboxes',
 '#title' =&#62; t('Choose the nodes'),
 '#options' =&#62; node_get_types('names'),
 '#default_value' =&#62; variable_get('node_nodes_types', array('page'))
 );

 return system_settings_form($form);
}</pre>
<p>When submitted the system.module will store each key, value pair in the variable table. As mentioned, you do not write your own submit hook when using the system_settings_form, you only set up the form and then handle the validation like here:</p>
<pre>function node_nodes_admin_settings_validate($form, $form_state) {
 $node_types = array_unique(array_values($form_state['values']['node_nodes_types']));

 if (count($node_types) == 1){
 form_set_error('node_nodes_types', t('BUGGER! Node Nodes needs at least one node type'));
 }  
}</pre>
<p>But the above only works if you don&#8217;t need to store data in a custom table, if you want to check it out, open up system.module and go to line 1041, that&#8217;s where the system_settings_form() function is located.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Actionscript 3, AMFPHP and Drupal 6]]></title>
<link>http://hyperblaster.wordpress.com/2009/04/23/actionscript-3-and-drupal/</link>
<pubDate>Thu, 23 Apr 2009 00:26:47 +0000</pubDate>
<dc:creator>hyperblaster</dc:creator>
<guid>http://hyperblaster.wordpress.com/2009/04/23/actionscript-3-and-drupal/</guid>
<description><![CDATA[Using Drupal Install the modules: Download my library Create your Flash Watch the magic happen]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Using Drupal</p>
<p>Install the modules:</p>
<p>Download my library</p>
<p>Create your Flash</p>
<p>Watch the magic happen</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal 6 AboutPeople Theme and FCKeditor Goes Black on Black]]></title>
<link>http://dontai.wordpress.com/2009/01/29/drupal-6-aboutpeople-theme-and-fckeditor/</link>
<pubDate>Thu, 29 Jan 2009 18:04:29 +0000</pubDate>
<dc:creator>dontai</dc:creator>
<guid>http://dontai.wordpress.com/2009/01/29/drupal-6-aboutpeople-theme-and-fckeditor/</guid>
<description><![CDATA[Problem: After installing the AboutPeople theme and FCKeditor on Drupal 6.9, when the editor is invo]]></description>
<content:encoded><![CDATA[Problem: After installing the AboutPeople theme and FCKeditor on Drupal 6.9, when the editor is invo]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal has been updated to version 6.8 o ... ]]></title>
<link>http://mimeblog.wordpress.com/2008/12/22/drupal-has-been-updated-to-version-68-o/</link>
<pubDate>Sun, 21 Dec 2008 23:44:23 +0000</pubDate>
<dc:creator>Mike</dc:creator>
<guid>http://mimeblog.wordpress.com/2008/12/22/drupal-has-been-updated-to-version-68-o/</guid>
<description><![CDATA[Drupal has been updated to version 6.8 on the 11th of December, if you haven&#8217;t updated yet it]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Drupal has been updated to version 6.8 on the 11th of December, if you haven&#8217;t updated yet it&#8217;s time to do so!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Using open source to build a user friendly library website that's relevant to the lives of users...]]></title>
<link>http://libraryofdigress.wordpress.com/2008/10/23/using-open-source-to-build-a-user-friendly-library-website-thats-relevant-to-the-lives-of-users/</link>
<pubDate>Thu, 23 Oct 2008 11:08:10 +0000</pubDate>
<dc:creator>Christine Rooney-Browne</dc:creator>
<guid>http://libraryofdigress.wordpress.com/2008/10/23/using-open-source-to-build-a-user-friendly-library-website-thats-relevant-to-the-lives-of-users/</guid>
<description><![CDATA[Librarian in Black blogged about this a few weeks ago but this is the first chance I&#8217;ve had to]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://librarianinblack.typepad.com/librarianinblack/">Librarian in Black</a> blogged about this a few weeks ago but this is the first chance I&#8217;ve had to check out the new <a href="http://www.darienlibrary.org/">Darien Library website</a>.  It&#8217;s the brainchild of self confessed library geek <a href="http://www.blyberg.net/">John Blyberg</a> who, in a previous life was instrumental in the development of <a href="http://libraryofdigress.wordpress.com/2008/04/10/ann-arbour-public-library-makes-the-most-of-web-20/">my other favourite</a> library website &#8211; <a href="http://www.aadl.org/">Ann Arbor Public Library</a>.</p>
<p>But with Darien Library John has taken it to the next level, using <a href="http://www.thesocialopac.net/">SOPAC 2.0</a> and <a href="http://drupal.org/drupal-6.0">Drupal 6</a> to create a library website that looks cool, is a joy to navigate around and actually works!  Also, a big plus for those of us interested in the social networking aspects of public library life, the website also supports and encourages the creation, storage  and sharing of &#8220;local, community-driven social data&#8221; (<a href="http://www.blyberg.net/">Blyberg, 2008</a>).   Brilliant! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Verberg de node titel bij het users profile]]></title>
<link>http://jebe.wordpress.com/2008/06/13/verberg-de-node-titel-bij-het-users-profile/</link>
<pubDate>Fri, 13 Jun 2008 18:54:26 +0000</pubDate>
<dc:creator>J-B</dc:creator>
<guid>http://jebe.wordpress.com/2008/06/13/verberg-de-node-titel-bij-het-users-profile/</guid>
<description><![CDATA[Om onze nieuwe scoutssite ook een beetje een esthetisch verantwoord voorkomen te geven moest er één ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Om onze nieuwe scoutssite ook een beetje een esthetisch verantwoord voorkomen te geven moest er één klein probleempje opgelost worden. Wanneer je het profiel bekeek van iemand van de leiding, moesten we van het standaard titeltje (dat drupal 6.x, vriendelijk als het is, bij elke node voorziet) af zien te  geraken.</p>
<p>Gemakkelijker gezegd dan gedaan dus, maar uiteindelijk is deze code in m&#8217;n page.tpl.php terechtgekomen:</p>
<p><code><br />
&#60;?php $pattern ="/([a-zA-Z0-9\?\=\/])+user([\/a-zA-Z0-9_-])+/";<br />
if (!preg_match($pattern, $path) &#38;&#38; $title): print '<br />
<h2>'. $title .'</h2>
<p>'; endif; ?&#62;</code></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal 6: Redirect Users to your Frontpage/Startpage/node after they logged in]]></title>
<link>http://sysblogd.wordpress.com/2008/05/12/drupal-6-redirect-users-to-your-frontpagestartpagenode-after-they-logged-in/</link>
<pubDate>Mon, 12 May 2008 16:08:29 +0000</pubDate>
<dc:creator>sysblog</dc:creator>
<guid>http://sysblogd.wordpress.com/2008/05/12/drupal-6-redirect-users-to-your-frontpagestartpagenode-after-they-logged-in/</guid>
<description><![CDATA[In Drupal 6 this can be done with core modules like this: enable Trigger module add an action add ad]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>In Drupal 6 this can be done with core modules like this:</p>
<ol>
<li>enable <a href="http://your-domain-path-to-drupal/admin/build/modules">Trigger module</a></li>
<li>add an <a href="http://your-domain-path-to-drupal/admin/settings/actions">action</a></li>
<li>add advanced action at the bottom and choose &#8220;Redirect to URL&#8221;</li>
<li>use description regardless of <em>how</em> you will use it but rather describing what this action does; e.g. &#8220;redirect to start node&#8221;</li>
<li>as URL apply &#8220;node&#8221; (without the quotation marks). Instead of node you can redirect to any url you like. See my screenshot for how it could look.</li>
<li>set-up the <a href="http://your-domain-path-to-drupal/admin/build/trigger/user">appropriate trigger</a></li>
<li>from the drop-down list at &#8220;Trigger: After a user has logged in&#8221; select your new action from just now</li>
<li>log out and back in again to test it</li>
</ol>
<p>Note: In the links provided you need to change &#8220;your-domain-path-to-drupal&#8221; with your actual domain name to become something like http://example.com/admin. Or navigate as usual if you now where to find the settings pages in Drupal 6. If you happen to have clean urls disabled you might know already that you need to prefix the admin path (as every other path) by &#8220;?q=&#8221; so it all together looks like this: http://example.com/?q=admin. This, however, doesn&#8217;t concern the node parameter where you redirect to. That&#8217;s always an internal relative path without the leading slash; or some full url of corse.</p>
<p style="text-align:center;"><a href="http://sysblogd.wordpress.com/files/2008/09/redirect_to_node_action.png"><img class="aligncenter size-medium wp-image-212" title="redirect_to_node_action" src="http://sysblogd.wordpress.com/files/2008/09/redirect_to_node_action.png?w=300" alt="" width="300" height="168" /></a></p>
<p><strong>Update 05/2009:</strong> If you want a simple module to do that for you useLogin Destination. To redirect user/1 to <code>/admin</code> and site users &#8220;back&#8221; to the page they logged in from the following PHP snippet should work for Drupal 6 (not tested, feedback welcome!):</p>
<pre class="brush: vb;">
global $user;
  if ($user-&gt;uid == 1) {
    // Redirect the Administrator
    return 'admin';
  } else {
    return ($_REQUEST['q']);
  }
</pre>
<p>Resources</p>
<ul>
<li><a href="http://www.scribbledesigns.co.uk/2008/04/03/howto-configuring-triggers-and-actions-in-drupal-6/">HowTo trigger Emails when Comment has been posted</a></li>
<li>for advanced redirects see <a href="http://drupal.org/project/login_destination">Login Destination module</a> or <a href="http://drupal.org/project/login_destination"></a><a href="https://drupal.org/project/token">Token module</a></li>
</ul>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Drupal is Six Wallpaper]]></title>
<link>http://marcrobinsone.wordpress.com/2007/12/15/drupal-is-six-wallpaper/</link>
<pubDate>Sat, 15 Dec 2007 19:30:43 +0000</pubDate>
<dc:creator>marcrobinsone</dc:creator>
<guid>http://marcrobinsone.wordpress.com/2007/12/15/drupal-is-six-wallpaper/</guid>
<description><![CDATA[Drupal is Six Wallpaper]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><img src="http://marcrobinsone.wordpress.com/files/2007/12/marcrobinsonegmailcom__drupal_wp_drupal6betapreview.jpg" alt="Drupal is Six Wallpaper" /></p>
<p><a href="http://marcrobinsone.wordpress.com/files/2007/12/marcrobinsonegmailcom__drupal_wp_drupal6beta.jpg" title="Drupal is Six Wallpaper">Drupal is Six Wallpaper</a></p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
