Friday, January 20, 2012

PHP Code to remove directory & its files

<?php

function rrmdir($dir) {
  if (is_dir($dir)) {
  if (is_dir($dir)) {
    $objects = scandir($dir);
    foreach ($objects as $object) {
      if ($object != "." && $object != "..") {
        if(filetype($dir."/".$object) == "dir")     rrmdir($dir."/".$object); else unlink($dir."/".$object);
      }
    }
    reset($objects);
    rmdir($dir);
  }
}


?>

Tuesday, January 10, 2012

Theming nodes based on content type in Drupal 7

*The file node.tpl.php is used to theme certain types of nodes.

*This file will be in module/node folder in the root directory.

*To theme individual content types in different ways, you need to create a file node--[type].tpl.php in your theme's folder & copy the content from node.tpl.php to this file, where [type] is the machine readable name of the content type

*only diference between Drupal 6 & Drupal 7 is ,Drupal 7 use two hyphens

node--story.tpl.php
Themes only Story type nodes.

node--forum.tpl.php
Themes only Forum type nodes.

Theming nodes based on content type in Drupal 6

Theming nodes based on content type in drupal 6

*The file node.tpl.php is used to theme certain types of nodes.

*This file will be in module/node folder in the root directory.

*To theme individual content types in different ways, you need to create a file node-[type].tpl.php in your theme's folder & copy the content from node.tpl.php to this file, where [type] is the machine readable name of the content type

node-story.tpl.php
Themes only Story type nodes.

node-forum.tpl.php
Themes only Forum type nodes.