sudeepg's blog

Embedding Views and passing filters to exposed filters in Drupal

Submitted by sudeepg on Mon, 05/19/2008 - 19:23.

    $view3 = views_get_view('SportsFeed');
    $filters = views_get_filter_values(array('filter0' => arg(2)));
    $scroll_str = (views_build_view('embed', $view3, array(), false, 0, 0, 0, $filters));

$remove = array("<li>",'<ul id="view-sportsfeed">',"\n");
$strrss = str_replace($remove,"",$scroll_str);
$remove = array("</li>", "</ul>");

How to pass filter to Views?

Submitted by sudeepg on Sat, 03/15/2008 - 07:02.

$view = views_get_view('popular_location_upcoming');
$filters = views_get_filter_values(array('filter0' => 'chicago'));
print views_build_view('block', $view, $args, false, 0, 0, 0, $filters);

How to Get Equal Height Columns in HTML Design?

Submitted by sudeepg on Tue, 02/26/2008 - 08:52.

There is a  problem with  "Equal Height Columns" as discussed in: http://www.positioniseverything.net/articles/onetruelayout/appendix/equa...

So, found the alternative at:

 

http://articles.techrepublic.com.com/5100-22-5268973.html

 

 

How to find free Ebooks using Google Search Engine

Submitted by sudeepg on Sat, 02/23/2008 - 08:41.

Type in the following command with your keywords for the book that you are looking at and you would find free ebooks on the internet available:
Google: -inurl:htm -inurl:html intitle:"index of" +("/ebooks"|"/book") +(chm|pdf|zip)

How to display fullname in Drupal instead of username using template.php

Submitted by sudeepg on Sat, 01/05/2008 - 20:49.

Following function in template.php does the trick:

node_save: The way to save node to your Drupal Code without running into INSERT query?

Submitted by sudeepg on Wed, 01/02/2008 - 07:47.

I was trying to create a new node programatically by inserting information in node, node_revision tables and using "sequences" table to figure out what is the latest nid and vid. But, for some reason it was failing and then I found the saviour, "node_save", the easy one.

The following code saves your node without any bug, error or tension:

How to print "latest avatar" user list in a block in Drupal? Php code?

Submitted by sudeepg on Thu, 12/27/2007 - 12:58.

1. Go to Admin

2. Go to Blocks

3. Add Block

4. Add following code. 

 

Autoresponder with WebForm

Submitted by sudeepg on Fri, 12/21/2007 - 20:53.

Put this code in webform->edit>"Advanced Setting"->"Advanced Processing" and make changes according to your requirement. This code would be executed when the webform is submitted.

How to send emails on Drupal in PHP code?

Submitted by sudeepg on Fri, 12/07/2007 - 20:32.

 $from_site = variable_get('site_mail', ini_get('sendmail_from')); // fetch site-email address.

  if ($from_site) {
    $headers['Sender'] = $headers['Return-Path'] = $headers['Errors-To'] = $from_site;
  }

 

How to fix template files in IE6/IE7 when everything is working fine in firefox?

Submitted by sudeepg on Fri, 12/07/2007 - 19:52.

Simply, create a css for IE6/IE7 say it is ie6.css and/or ie7.css and add the following lines to page.tpl.php:

 

<!--[if IE 6]>
<style type="text/css" media="all">@import "<?php print base_path() . path_to_theme() ?>/css/ie6.css";</style>
<![endif]-->

<!--[if IE 7]>
<style type="text/css" media="all">@import "<?php print base_path() . path_to_theme() ?>/css/ie7.css";</style>
<![endif]-->