Showing posts from September, 2012

Node Menu Parent - Module

The Node Menu Parent module extends the "default menu for content" setting provided by the core menu module by allowing a specific menu item to be selected (not just a top-level menu) per content type.
Example Imagine we're creating a site for a business that will have a section describing the products they offer. We've got the core content types, Page and Story, and we've added our own content type called Product. Then we add a few pages under the Primary links menu, like so:
<Primary links> ProductsSupportAbout Us Now say we've decided that every product should have a menu item under Products. However, core Drupal's menu settings only let us choose a global default menu for content, such as Primary links. That means when we go to create a Product, the "Parent item" dropdown under "Menu settings" defaults to Primary links so every time we create a product we have to manually select Products as the parent item. This is …

reCAPTCHA - Module

Uses the reCAPTCHA web service to improve the CAPTCHA system and protect email addresses.


jcarousel view returns empty row

Go its Views settings.Add a relationship. Search for "fid" in the list and check the field your jCarousel is using.Add an extra filter criterion. Search for "fid" and once again: check the same field.Using these settings for this field: Operator: is not empty (NOT NULL)Save

Menu Browser - Module

Makes it easier for editors to place their content exactly where they want it inside their menus.
This module adds a menu browser to the content forms. Users don't choose "parent" and "weight" for the menu item they are adding. Instead they choose a menu, and the menu gets loaded using ajax. The users then places the menu item inside the menu by clicking on the item they want to place the menu below. New menu items may also be placed as children of existing menu items.
To use this module install and enable it the normal way. It doesn't create any tables or variables. It replaces the menu part of the content forms.
This module should work well on touch-screen devices. (Only tested with Android devices so far)


Overview-approach to block visibility

As of Drupal 5.x you can specify what roles can see a block through the block admin UI, but using PHP still gives you extra flexibility.
If you are going to set visibility on a lot of blocks, see Block Page Visibility
Review of how the role visibility works in Drupal 5
If no role check boxes are checked, block is visible to all roles.If "authenticated user" is checked, all logged in users will see the block, checking any of the other role boxes (other than anonymous user) is meaningless.Checking anonymous users means that logged-in users, unless they belong to another role that is also checked, will not see the block.Basics of setting visability via PHP:
Go to administer >> access control and ensure “administer blocks “ and “use PHP for block visibility” are checked for your role. Go to administer >> blocks and find the block you want to set the visibility for.Click “configure” next to that block. Under the section entitled, “Page specific visibility settings”…

PDF to ImageField - Module

The PDF To ImageField module provides automatic conversion of uploaded PDF files to images.
It can be used either to create a snapshot of the front page to use as a preview thumbnail, or to generate a gallery of images from each page in the document.
The module is implemented as an additional widget for File Field where PDFs are uploaded to. It places generated images into a Image Field on the same content type.

Read More ....

Validation on Menu Link Title

function node_form_submit($form, &$form_state) {
      $item = &$form_state['values']['menu'];
 if (preg_match('/[^a-z A-Z0-9-]/', $item['link_title'])) {
    form_set_error('link_title', t('The title name may only consist of lowercase letters, numbers, and hyphens.'));

  global $user;

  $node = node_form_submit_build_node($form, $form_state);
  $insert = empty($node->nid);
  $node_link = l(t('view'), 'node/'. $node->nid);
  $watchdog_args = array('@type' => $node->type, '%title' => $node->title);
  $t_args = array('@type' => node_get_types('name', $node), '%title' => $node->title);

  if ($insert) {
    watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link);
    drupal_set_message(t('@type %title has been created.', $t_args));
  else {

Drupal menu system

The Drupal menu system was always much more than what the name suggests. It's not only used to display visible navigation menus but also to map Drupal paths to their callbacks with proper access checking. This second task is called dispatching. The likely rationale behind this; once you define a link to a page, you might want to define what happens when you click that link.
This eventually led to a very complex data structure which was stored as a serialized array in the database -- per user. Unserializing this on every non-cached page load uses tons of memory. Altering this either on build or run time needs dirty hacks.
Some misunderstandings about how access to an element applies to their children led to grave security holes with some contributed modules. This stresses the need for thought out, cleanly defined inheritance rules.
We have a new menu system in Drupal 6.x. The data is divided between two tables: {menu_router} and {menu_links}. The {menu_router} table is built…


The update system is used by modules to provide database updates which are run with update.php.
Implementations of these hooks should be placed in a mymodule.install file in the same directory as mymodule.module.
Functions & methods

NameDescriptionhook_disablePerform necessary actions before module is disabled.hook_enablePerform necessary actions after module is enabled.hook_installInstall the current version of the database schema, and any other setup tasks.hook_requirementsCheck installation requirements and do status reporting.hook_schemaDefine the current version of the database schema.hook_uninstallRemove any information that the module sets.hook_update_last_removedReturn a number which is no longer available as hook_update_N().hook_update_NPerform a single update.
Read More


A Drupal schema definition is an array structure representing one or more tables and their related keys and indexes. A schema is defined by hook_schema() which must live in your module's .install file.
By implementing hook_schema() and specifying the tables your module declares, you can easily create and drop these tables on all supported database engines. You don't have to deal with the different SQL dialects for table creation and alteration of the supported database engines.
See the Schema API documentation at for details on hook_schema(), where database tables are defined.
Return value A schema definition structure array. For each element of the array, the key is a table name and the value is a table structure definition.

Read More..

OOPS (Object-oriented programming) Interview Questions

What is Polymorphisms? Polymorphism means one interface and many forms. Polymorphism is a characteristics of being able to assign a different meaning or usage to something in different contexts specifically to allow an entity such as a variable, a function or an object to have more than one form.

There are two types of Polymorphism.
Compile time: function or operator overloading
Runtime: Inheritence & virtual functions What is Abstract method? Abstract method doesn't provide the implementation & forces the derived class to override the method. What is Virtual method? Virtual Method has implementation & provide the derived class with the option to override it. Can Struct be inherited? No, Struct can't be inherited as this is implicitly sealed. What is Object? Object is anything that is identifiable as a single material item. What is Class? A Class is the generic definition of what an object is a template.

The keyword class in C# indicates that we are going to define…