Chaitanya Lakshmi
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook

What is hook_preprocess() in Drupal?

2/29/2012

0 Comments

 
Syn: hook_preprocess(&$variables, $hook)

hook_preprocess used to Preprocess theme variables for template files.

This hook allows modules to preprocess theme variables for theme templates. It is only called for theme hooks implemented as template files, but not for those implemented as theme functions. The purpose of this hook is to allow modules to add to or override variables for all template files.

Parameters:

$variables: The variables array (modify in place).
$hook: The name of the theme hook.

0 Comments

Differences between hook_boot() and hook_init() in Drupal?

2/29/2012

1 Comment

 
  1. hook_boot() is called before modules or most include files are loaded into memory (1.e., This hook will called while Drupal is still in bootstrap mode).
  2. hook_init()  is called After all modules are loaded into memory.


  1. hook_boot() is called event though the pages / Views got cached.
  2. hook_init() will not run on cached Pages.

1 Comment

What is custom_url_rewrite_outbound in Drupal?

2/29/2012

0 Comments

 
Syn: custom_url_rewrite_outbound(&$path, &$options, $original_path)

  1. custom_url_rewrite_outbound is not a hook, it's a function.
  2. You can add to settings.php to alter all links generated by Drupal.
  3. This function is called from url().
  4. This function is called very frequently (100+ times per page) so performance is critical.

This function should change the value of $path and $options by reference.

Parameters:

$path: The alias of the $original_path as defined in the database. If there is no match in the database it'll be the same as $original_path

$options: An array of link attributes such as querystring and fragment. See url().

$original_path: The unaliased Drupal path that is being linked to.

0 Comments

What is custom_url_rewrite_inbound in Drupal?

2/29/2012

0 Comments

 
Syn: custom_url_rewrite_inbound(&$result, $path, $path_language)

  1. custom_url_rewrite_inbound is not a hook, it's a function.
  2. You can add to settings.php to alter incoming requests so they map to a Drupal path.
  3. This function is called before modules are loaded and the menu system is initialized and it changes $_GET['q'].

This function should change the value of $result by reference.

Parameters:

$result: The Drupal path based on the database. If there is no match in the database it'll be the same as $path.

$path: The path to be rewritten.

$path_language: An optional language code to rewrite the path into.

0 Comments

What is a Hook?

2/29/2012

0 Comments

 
Hook Allow modules to interact with the Drupal core.

Drupal's module system is based on the concept of "hooks". A hook is a PHP function. Each hook has a defined set of parameters and a specified result type.
0 Comments

What are Web 2.0 Features?

2/29/2012

0 Comments

 
  1. Cascading style sheet to allow users to control website content presentation and separation
  2. XHTML & HTML markups validated semantically
  3. Syndication, aggregation & notification of data in RSS feeds
  4. Web log publishing tools, wikis or forums, instant messengers etc
  5. Websites with Collaborative tagging, social classification, social indexing and social tagging can be developed
  6. XML, JavaScript based APIs can be used for website development
  7. Completely dynamic and interactive website development using Open source technologies and rich internet applications
0 Comments

How to add new column after installing Module in Drupal?

2/28/2012

0 Comments

 
Using a hook_update_n() function we can able to add New Columns to the table.
Here, 'n' represents the number.

Suppose if we want to add a new column called 'newcol' to mytable1. First, we have to update our schema structure in modulename_schema() so that newly created tables get the new column. Then, add an update function to modulename.install:

<?php
function modulename_update_1() {
  $ret = array();
  db_add_field($ret, 'mytable1', 'newcol', array('type' => 'int'));
  return $ret;
?>
0 Comments

What are the advantages of CURL Library?

2/27/2012

1 Comment

 
PHP supports libcurl, a library that allows you to connect and communicate to many different types of servers with many
different types of protocols.

LIBCURL (CURL LIBRARY PHP)currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols.

LIBCURL (CURL LIBRARY PHP) also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP’s ftp
extension), HTTP form based upload, proxies, cookies, and
user plus password authentication

1 Comment

Define CURL?

2/27/2012

0 Comments

 
curl is a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

A typical PHP cURL usage follows the following sequence of steps.

curl_init – Initializes the session and returns a cURL handle which can be passed to other cURL functions.

curl_opt – This is the main work horse of cURL library. This function is called multiple times and specifies what we want the cURL library to do.

curl_exec – Executes a cURL session.

curl_close – Closes the current cURL session.

Below are some examples which should make the working of cURL more clearer.

The below piece of PHP code uses cURL to download Google’s RSS feed.

0 Comments

Should I use an HTTP GET or POST for my AJAX calls?

2/27/2012

0 Comments

 
AJAX requests should use an HTTP GET request when retrieving data where the data will not change for a given request URL. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idem potency recommendations and is highly recommended for a consistent web application architecture.
0 Comments
<<Previous

    Archives

    April 2012
    March 2012
    February 2012

    Categor

    All
    Ajax
    Api
    Cross Site Scripting
    Css
    Curl
    Design Patterns
    Drupal
    Exception Handling
    Htaccess
    Html
    Javascript
    Jquery
    Json
    Linux
    Mysql
    Oops
    Php
    Regular Expressions
    Web 2.0
    Webservices
    Wordpress
    Xhtml

    RSS Feed

Powered by Create your own unique website with customizable templates.