Google launched GOOGLE GEARS, a browser plug-in that will let people run Web applications when they’re connected to the Internet or not. The main aim of Google Gears is to create a single, standardized way to add offline capabilities to Web applications.
Gear has three components–a local Web server which runs in the browser, the open-source database SQLite for storage, and browser extensions that allow multiple JavaScript jobs to run in parallel.The initial code is for JavaScript developers who write Ajax-style Web Applications.It is compatible with Internet Explorer on Windows; Firefox on Windows, Mac OS and Linux; and on the Safari Mac OS browser.
Check this link for more details: http://news.cnet.com/Google-kicks-offline-Web-apps-into-gear/2100-7345_3-6187596.html?tag=lia;rcol
Monday, April 12, 2010
Importing Mysql Database using command Prompt
Importing Mysql Database using command Prompt
We can import Mysql database using command line
We can use the ’source’ command to import database
Syntax :
use database name
source .sql file name along path
Example
use my_data1
source c:\db\mydata.sql
We can import Mysql database using command line
We can use the ’source’ command to import database
Syntax :
use database name
source .sql file name along path
Example
use my_data1
source c:\db\mydata.sql
Drupal Module Development
What does a module do?
‣ Core modules provides functionality
‣ Contributed modules extends functionality
Examples of modules
Core required modules:
‣ System, Filter, Node, Block, User
‣ Core optional modules:
‣ Taxonomy, Menu, Comment, Search
3rd party modules:
‣ Views, Panels, CCK, Devel
Hooks
‣ Can be thought of as internal Drupal events
‣ Allow modules to interact with the Drupal core
‣ Events include:
‣ Creation, deletion of nodes and users
‣ Logging in, logging out
‣ Hooks can also create and alter menus and
forms
Hook examples
‣ hook_user
‣ login, logout, insert, view, update
‣ hook_block
‣ view, save, configure, list
‣ hook_form_alter
‣ hook_insert
‣ hook_comment
‣ insert, update, view, publish, unpublish
hook_user - allows the module to react when operations are performed
hook_block - declares a block or set of blocks
hook_form_alter - performs alterations to a form or forms before it’s rendered
Useful modules
‣ Devel (drupal.org/project/devel)
‣ Admin Menu (drupal.org/project/admin_menu)
‣ Drush (drupal.org/project/drush)
‣ Any others?
Module builder - still in beta. For the lazy.
Drush - command line utility. Drupal Shell. Installing modules, clearing cache, run SQL commands on the database
Our first module
‣ ‘Hello World’ block module
‣ Two files required for a module:
‣ helloworld.info
‣ helloworld.module
‣ (Optionally) helloworld.install
What is a block? Blocks are snippets of text or functionality that usually live outside the main content area of a
web site.
Where should I put my module?
‣ Everyone elses:
‣ /sites/drupalsouth.local/modules/contrib
‣ Yours (in development):
‣ /sites/drupalsouth.local/modules/dev
‣ Yours (after development):
‣ /sites/drupalsouth.local/modules/boost
helloworld.info
; $Id$
name = Hello World
description = Creates a Hello World block
package = Dev
core = 6.x
9
helloworld.module
function helloworld_block($op = ‘list’, $delta = 0, $edit = array())
{
switch($op)
{
case ‘list’:
$block[0][‘info’] = t(‘Hello World’);
return $block;
break;
}
}
Only first Edit contains submitted form data from block config form.
case ‘view’:
$block[‘subject’] = t(‘Hello World!’);
$content = ‘Hello world!’;
$block[‘content’] = $content;
return $block;
break;
case ‘configure’:
$form[‘helloworld_count’] = array(
‘#type’ => ‘textfield’,
‘#title’=> t(‘Number of Hello Worlds to display’),
‘#default_value’ => variable_get(‘helloworld_count’, 1)
);
return $form;
break;
case 'save':
variable_set('helloworld_count', $edit['helloworld_count']);
break;
case ‘view’:
$block[‘subject’] = t(‘Hello World!’);
$count = variable_get(‘helloworld_count’, 1);
for ($i = 0; $i < $count; $i++)
{
$content .= 'Hello world! ';
}
$block['content'] = $content;
return $block;
break;
Theming a module
‣ Register a theme
‣ Implement a theme function
‣ Applying the theme
‣ Utilise external theme templates
Registering a theme
function helloworld_theme()
{
return array(
‘helloworld_show’ => array(
‘arguments’ => array(‘content’ => NULL),
),
);
}
Implementing theme
function theme_helloworld_show($content)
{
$output = ‘
return $output;
}
Applying the theme
case 'view':
$block['subject'] = t('Hello World!');
$count = variable_get('helloworld_count', 1);
for ($i = 0; $i < $count; $i++)
{
$text .= 'Hello world! ';
}
$content = theme('helloworld_show', $text);
$block['content'] = $content;
return $block;
break;
External theme file
function helloworld_theme()
{
return array(
'helloworld_show' => array(
'arguments' => array('content' => NULL),
'template' => 'helloworld_show'
),
);
}
helloworld_show.tpl.php
Using deltas
function helloworld_block($op = ‘list’, $delta = 0, $edit = array())
{
switch($op)
{
case ‘list’:
$blocks[0][‘info’] = t(‘Hello World’);
$blocks[1][‘info’] = t(‘Goodbye Cruel World’);
return $blocks;
break;
}
}
Delta - unique block id (per implementation of hook_block). Can be an integer or string.
Using deltas
case 'view':
switch ($delta) {
case 0:
$block['subject'] = t('Hello World!');
$content = 'Hi! :-)';
break;
case 1:
$block['subject'] = t('Goodbye Cruel World!');
$content = 'Bye... :-(';
break;
}
$block['content'] = $content;
‣ Core modules provides functionality
‣ Contributed modules extends functionality
Examples of modules
Core required modules:
‣ System, Filter, Node, Block, User
‣ Core optional modules:
‣ Taxonomy, Menu, Comment, Search
3rd party modules:
‣ Views, Panels, CCK, Devel
Hooks
‣ Can be thought of as internal Drupal events
‣ Allow modules to interact with the Drupal core
‣ Events include:
‣ Creation, deletion of nodes and users
‣ Logging in, logging out
‣ Hooks can also create and alter menus and
forms
Hook examples
‣ hook_user
‣ login, logout, insert, view, update
‣ hook_block
‣ view, save, configure, list
‣ hook_form_alter
‣ hook_insert
‣ hook_comment
‣ insert, update, view, publish, unpublish
hook_user - allows the module to react when operations are performed
hook_block - declares a block or set of blocks
hook_form_alter - performs alterations to a form or forms before it’s rendered
Useful modules
‣ Devel (drupal.org/project/devel)
‣ Admin Menu (drupal.org/project/admin_menu)
‣ Drush (drupal.org/project/drush)
‣ Any others?
Module builder - still in beta. For the lazy.
Drush - command line utility. Drupal Shell. Installing modules, clearing cache, run SQL commands on the database
Our first module
‣ ‘Hello World’ block module
‣ Two files required for a module:
‣ helloworld.info
‣ helloworld.module
‣ (Optionally) helloworld.install
What is a block? Blocks are snippets of text or functionality that usually live outside the main content area of a
web site.
Where should I put my module?
‣ Everyone elses:
‣ /sites/drupalsouth.local/modules/contrib
‣ Yours (in development):
‣ /sites/drupalsouth.local/modules/dev
‣ Yours (after development):
‣ /sites/drupalsouth.local/modules/boost
helloworld.info
; $Id$
name = Hello World
description = Creates a Hello World block
package = Dev
core = 6.x
9
helloworld.module
function helloworld_block($op = ‘list’, $delta = 0, $edit = array())
{
switch($op)
{
case ‘list’:
$block[0][‘info’] = t(‘Hello World’);
return $block;
break;
}
}
Only first Edit contains submitted form data from block config form.
case ‘view’:
$block[‘subject’] = t(‘Hello World!’);
$content = ‘Hello world!’;
$block[‘content’] = $content;
return $block;
break;
case ‘configure’:
$form[‘helloworld_count’] = array(
‘#type’ => ‘textfield’,
‘#title’=> t(‘Number of Hello Worlds to display’),
‘#default_value’ => variable_get(‘helloworld_count’, 1)
);
return $form;
break;
case 'save':
variable_set('helloworld_count', $edit['helloworld_count']);
break;
case ‘view’:
$block[‘subject’] = t(‘Hello World!’);
$count = variable_get(‘helloworld_count’, 1);
for ($i = 0; $i < $count; $i++)
{
$content .= '
}
$block['content'] = $content;
return $block;
break;
Theming a module
‣ Register a theme
‣ Implement a theme function
‣ Applying the theme
‣ Utilise external theme templates
Registering a theme
function helloworld_theme()
{
return array(
‘helloworld_show’ => array(
‘arguments’ => array(‘content’ => NULL),
),
);
}
Implementing theme
function theme_helloworld_show($content)
{
$output = ‘
- $content
return $output;
}
Applying the theme
case 'view':
$block['subject'] = t('Hello World!');
$count = variable_get('helloworld_count', 1);
for ($i = 0; $i < $count; $i++)
{
$text .= '
}
$content = theme('helloworld_show', $text);
$block['content'] = $content;
return $block;
break;
External theme file
function helloworld_theme()
{
return array(
'helloworld_show' => array(
'arguments' => array('content' => NULL),
'template' => 'helloworld_show'
),
);
}
helloworld_show.tpl.php
This is being called from the external file.
Using deltas
function helloworld_block($op = ‘list’, $delta = 0, $edit = array())
{
switch($op)
{
case ‘list’:
$blocks[0][‘info’] = t(‘Hello World’);
$blocks[1][‘info’] = t(‘Goodbye Cruel World’);
return $blocks;
break;
}
}
Delta - unique block id (per implementation of hook_block). Can be an integer or string.
Using deltas
case 'view':
switch ($delta) {
case 0:
$block['subject'] = t('Hello World!');
$content = 'Hi! :-)';
break;
case 1:
$block['subject'] = t('Goodbye Cruel World!');
$content = 'Bye... :-(';
break;
}
$block['content'] = $content;
Monday, April 5, 2010
Ubercart for Drupal- Know how!
Ubercart is a e-commerce module suite for Drupal which consists of set of modules designed to allow you to run a store on your Drupal site. All front end modules are integrable and configurable using drupal modules.Development has been driven by two major emphases: flexibility and usability. The various systems driving Ubercart, including the product catalog,shopping cart and checkout, order, shipping, and payment systems have all beendesigned to be extended to meet any need. Furthermore, the administrative interface, particularly relating to processing and fulfilling orders, has been designed for ease of use and efficient display of information.
It is a great solution for stores that selling physical products.
Ubercart is being sponsored and developed by the team at
http://www.ubercart.org
Sign up for site access to join the Ubercart community
and take advantage of our forums and issue tracking.
Features overview:
http://www.ubercart.org/what_is_ubercart
Screenshots:
http://www.ubercart.org/screenshots
User’s and Developer’s Guides:
http://www.ubercart.org/docs
Installation Manual (with module descriptions):
http://www.ubercart.org/docs/user/90/installing_ubercart
Support forums:
http://www.ubercart.org/forum
It is a great solution for stores that selling physical products.
Ubercart is being sponsored and developed by the team at
http://www.ubercart.org
Sign up for site access to join the Ubercart community
and take advantage of our forums and issue tracking.
Features overview:
http://www.ubercart.org/what_is_ubercart
Screenshots:
http://www.ubercart.org/screenshots
User’s and Developer’s Guides:
http://www.ubercart.org/docs
Installation Manual (with module descriptions):
http://www.ubercart.org/docs/user/90/installing_ubercart
Support forums:
http://www.ubercart.org/forum
Friday, April 2, 2010
Ubercart - How to Mask credit card number on review page
We use Ubercart for most of our basic and complex e-commerce requirements.
Recently, our client required that the CC number should not be displayed in full on the final review order page. After a lot of Googling this what we finally did:
1. In the file: sites/all/modules/ubercart/payment/uc_credit/uc_credit.module
2. inside funtion uc_payment_method_credit() find this line of code at around line number 521 case ‘cart-review’
3. In this case statement you will find a line like this:
$review[] = array(’title’ => t(’Card Number’), ‘data’ => uc_credit_display_number($arg1->payment_details['cc_number']));
4. uc_credit_display_number() function takes a second paramter called mask (by default it is FALSE). Pass TRUE as this second parameter. So, now your code should look like this:
$review[] = array(’title’ => t(’Card Number’), ‘data’ => uc_credit_display_number($arg1->payment_details['cc_number'], TRUE));
Thats it!
On your review page the credit card number should be masked showing only the last for digits.
Recently, our client required that the CC number should not be displayed in full on the final review order page. After a lot of Googling this what we finally did:
1. In the file: sites/all/modules/ubercart/payment/uc_credit/uc_credit.module
2. inside funtion uc_payment_method_credit() find this line of code at around line number 521 case ‘cart-review’
3. In this case statement you will find a line like this:
$review[] = array(’title’ => t(’Card Number’), ‘data’ => uc_credit_display_number($arg1->payment_details['cc_number']));
4. uc_credit_display_number() function takes a second paramter called mask (by default it is FALSE). Pass TRUE as this second parameter. So, now your code should look like this:
$review[] = array(’title’ => t(’Card Number’), ‘data’ => uc_credit_display_number($arg1->payment_details['cc_number'], TRUE));
Thats it!
On your review page the credit card number should be masked showing only the last for digits.
Thursday, April 1, 2010
Steps to Embed Google Maps in Drupal Site
The Embed Google Maps module and Gmap block module provides a convenient way to embed Google Map into your Drupal site.
Gmap block module enables site admins to create blocks that containing a Google Map. Each map is highly configurable which contain multiple locations, created separately and are therefore reusable in multiple blocks. Each location is created by adding an address, and per location admins can specify whether or not a marker should be created, if an info window should be used and if a directions form should be used.
Gmap block module uses the GMap API version 3 which is exponentially faster than it’s predecessor. Version 3 also doesn’t require an API key.
Embed Google Maps allows CCK field for embedding Google Maps into nodes. You can embed any kind of Google Maps including driving directions and personal maps. You can also type a search query into the field and display the search results in the field.
These two are independent modules and can be enabled, configured separately.
DOWNLOAD LINKS
http://drupal.org/project/gmap_blocks
http://drupal.org/project/embed_gmap
REQUIREMENTS
Content Construction Kit (CCK)
INSTALLATION
Install as usual.
See http://drupal.org/node/70151 for further information.
Gmap block module enables site admins to create blocks that containing a Google Map. Each map is highly configurable which contain multiple locations, created separately and are therefore reusable in multiple blocks. Each location is created by adding an address, and per location admins can specify whether or not a marker should be created, if an info window should be used and if a directions form should be used.
Gmap block module uses the GMap API version 3 which is exponentially faster than it’s predecessor. Version 3 also doesn’t require an API key.
Embed Google Maps allows CCK field for embedding Google Maps into nodes. You can embed any kind of Google Maps including driving directions and personal maps. You can also type a search query into the field and display the search results in the field.
These two are independent modules and can be enabled, configured separately.
DOWNLOAD LINKS
http://drupal.org/project/gmap_blocks
http://drupal.org/project/embed_gmap
REQUIREMENTS
Content Construction Kit (CCK)
INSTALLATION
Install as usual.
See http://drupal.org/node/70151 for further information.
Wednesday, August 5, 2009
Subscribe to:
Posts (Atom)

