Skip to main content

Posts

Showing posts from October, 2013

Drupal Views exposed filter of Node title as drop down.

It can be done through using "Jump menu" settings in views. Download the Ctools module  http://drupal.org/project/ctools  Enable the Chaos Tools Module. This module provides a Views Style Plugin called "Jump Menu" Create a view of type node with two fields Content:nid and Cotent:title. And the path of the views page is like 'my_node_list'. For the Content:nid make sure you click on  Rewrite the output of the field . The rewritten output of the field should be  my_node_list/[nid]. Make sure you select the  exclude from display  checkbox. In the settings for  Style  in the view, select the  Jump Menu  style. Click on the settings for the style. Make sure the  Path  dropdown has 'Content:nid' choosen. Add a block display to the view. Name the block "Node details" and put the contextual filter to filter with nid. Save the view Go to block configuration under structure and configure the above block (Node details). Put the viewing restri

Drupal 7 - Views bread crumb module

There is no module which entirely support to give the bread crumbs on the views pages. So I created one module and tried to contribute to the community which contributed a lot to my carrier. I end up to merge my code with the other contributed modules which provides the breadcrumbs. Here is my sandbox project page:-  https://drupal.org/sandbox/rakeshjames/2049937 1)   views_breadcrumb.info  name = Views breadcrumb description =  Setting bread crumbs for all the view's pages. dependencies[] = views core = "7.x" configure = admin/structure/block/manage/views_breadcrumb/views_breadcrumb_block/configure 2)   views_breadcrumb.module  <?php /**  * @file  * This module will provide a block that will helps to set the bread crumb  * for views pages.  */ /**  * Implements hook_block_info().  */ function views_breadcrumb_block_info() {   $blocks['views_breadcrumb_block'] = array(     'info' => t('Views breadcrumb block'),  

Drupal 7 - Creating nodes with multiple images which already existing in public:// folder.

Her we creating nodes containing multiple images for each node. All these images already uploaded to the server under public://(sites/default/files/). And get all the information about the pictures and  nodes in .csv file under "sites/all/". Formatting the CSV. 1) All columns except for date should end with a semicolon 2) If we have multiple images in the same row, it should be separated with a '+'. <?php $image_node_csv = array(); if (($handle = fopen("sites/all/check_name.csv", "r")) !== FALSE) {   $row = 1;   while (($data = fgetcsv($handle, 1000, ";")) !== FALSE) {     $num = count($data);     $image_node_csv[$row] = $data;     $row++;   }   fclose($handle); } $count_node_to_creat = count($image_node_csv); for ($i = 2; $i <= $count_node_to_creat ; $i++){   $node = new StdClass();   $node->type = 'test';   $node->language = LANGUAGE_NONE;   $node->title = preg_replace(

Drupal 7 - create node programatically, adding a youtube embed to a field

<?php $node = new StdClass(); $node->type = 'card'; $node->language = LANGUAGE_NONE; $node->title = "Creating file node youtube"; $node->field_card_type['und'][0]['value'] = 'video'; $video_path = "http://www.youtube.com/watch?v=FmsgX1LkeRE"; module_load_include('inc', 'media_youtube', 'includes/MediaInternetYouTubeHandler.inc'); $obj = new MediaInternetYouTubeHandler($video_path); $file = $obj->getFileObject(); $file->display = 1; file_save($file); $node->field_card_upload_video['und'][0] = (array) $file; node_save($node); ?>