Path to Drupal Theme and Module

November 7th, 2008

Drupal Path to current theme

<?php
print '<img src="'. path_to_theme() .'/images/picture.jpg" />';
?>

Drupal Path to a theme

<?php
 drupal_get_path('module', $module_name);
?>

Drupal Path to a module

<?php
 drupal_get_path('theme', $theme_name);
?>

Theming Views 2 in Drupal 6

November 6th, 2008

I found a simple tutorial for newbie.. !!!

Click here… I spend more than one hour to find out this.. Pity me !

Adding Custom Menu

November 1st, 2008

Spending some time trying to find out this !

Sigh…

If you make additional menu and wants to put it in your theme, this is how to do it

&lt;?php print theme('links', menu_navigation_links('menu-machine-readable-name'), array('id' =&gt; 'menu_id', 'class' =&gt; 'menu_class')); ?&gt;

WYSIWYG Editor?

October 28th, 2008

This might not be the best, might not be the lightest, or might not be your favorite !

But I like it..

FCKEditor is my choice.

Download the module here

Download the editor here

Get All Nodes from one taxonomy

October 28th, 2008

Want to get all nodes classified under specific taxonomy?

Here we go:

&lt;?php

 $result = taxonomy_select_nodes(array($node-&gt;taxonomy[1]-&gt;tid));

 while ($row = db_fetch_object($result)) {

 print $row-&gt;nid."&lt;br /&gt;";

 }
 
?>

Need to display a node?

October 28th, 2008

Let me introduce you to some Drupal APIs

Node Load

to load a node variables

$node = node_load($nid);

Node View

To load a node teaser/full body view

$node = node_load($nid); 

print node_view($node)
 

Need a Search Engine Friendly URL?

October 28th, 2008

If you need a search engine friendly URL in drupal (who dont need anyway), pathauto is your best friend

Download PathAuto

Required Module: Token

Must Activated Core Module: Path

Lorem Ipsum Generator

October 27th, 2008

Don’t know what text to put in? Try Lorem Ipsum Generator. Click here

A bit introduction

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

.

Images in a scrolling horizontal div

October 27th, 2008

Need to put images in horizontal order and in scrolling div?

Here’s the trick

&lt;ul style="overflow: auto; width: 200px; white-space: nowrap;"&gt;
		&lt;li style="display: inline"&gt;IMG HERE&lt;/li&gt;
		&lt;li style="display: inline"&gt;IMG HERE&lt;/li&gt;
		&lt;li style="display: inline"&gt;IMG HERE&lt;/li&gt;
		&lt;li style="display: inline"&gt;IMG HERE&lt;/li&gt;
&lt;/ul&gt;

.

Image Cache - Using more than one presets

October 27th, 2008

If you want to use two presets or more, you can use this code..

Sigh.. Wasting hours looking for this answer.. Silly me !

&lt;?php
print theme('imagecache', $preset, $image['filepath'], $alt, $title, $attributes);
?&gt;

This is the example…

&lt;?php
print theme('imagecache', 'small', 'test.jpg', 'just a test image', 'test image');
?&gt;

..