How to get the total number of nodes displayed by the view

Technologies: 

There are times where we would want to view the total number of rows or data rows displayed in a view. The best way to do is to add a PHP snippet in the header section of a view. Fortunately, drupal views allow for adding code snippet into header and footer of a view.

However, this code snippet will work only if pager is enabled in the view. The code snippet:

<?php
  $view
= views_get_current_view();
  print
"<h4> Total Blood Banks: ".$view->total_rows." </h4>";
?>

In-case, you would want to get data from a particular view, you can provide the snippet:

Update Comment Status of a Node

Just recently I had the issue where a list of nodes imported via user import as a content profile had comment status disabled.

There were thousand of nodes to update, hence the best way was to use VBO. However, there was no option provided for comment status update, hence the alternative was to execute "Arbitrary PHP Code".

The following snippet below can be used for updating node status for nodes selected in VBO:

Add Tab - A Simple Drupal Module

Technologies: 

addtab is a simple Drupal Module that adds a tab that provides links for adding same content type, ie whenever a content is viewed a tab would appear that would link to creating similar content.

The Create tab that you can see in this page being displayed is basically due to this module.

A drupal module consists primarily of two files .info and .module file.

addtab.info:

; $Id$ addtab.info,v 1.0 2011/02/20 01:26:00 amitsedai Exp $
name = addtab
description = Creates a new tab in a node view for adding same content type
core = 6.x

Apache URL Redirection on VPS

I faced an issue with redirecting a particular URL to another URL at the Apache settings. You can write an index.php(php based solution) file for redirecting the header to the required URL. However, this didnt seem to me like an apt solution hence I looked for a solution at the Apache Config itself.

Considering you have a VPS where you have configured the virtual host as follows:

ServerName pr.example.com
ServerAlias pr.example.com
DocumentRoot /sites/www/pr.example.com/public_html/
ErrorLog /sites/www/pr.example.com/logs/error.log

PiTiVi Video Editor - A Look

I wanted to try a Linux based video editor for editing video files which would do both video editing, converting and video compression using various encoding schemes. I had a hands on with ffmpeg command line video compression and conversion tool. I felt it was impressive.

I am not a very much versed in video editing. I needed a tool that would help me do the basic stuff without much fuss. Fortunately, I found PiTiVi as just the right tool I needed.

PiTiVi is a free, intuitive and featureful movie editor for the Linux desktop.