Posts

Showing posts from 2011

How to secure drupal site

http://drupal.org/writing-secure-cod

Javascript debugger

http://www.purpleoar.co.nz/scryptik/download-shareware

How to import big .sql file in Mysql ?

Hello All, You cannot import using phpMyAdmin , if the backup file size is big. How to import big .sql  file in Mysql ? Solution: E:\xampp\mysql\bin>  mysql -u <username> -p          /* you have to change this path E:\xampp\mysql\bin , if you have installed XAMPP in different path */ mysql>password : <enter your password here> mysql> create database <databsename>                    /* if  needed */ mysql> use <databasename> mysql> source <sql file full path name eg, c:\temp\backup.sql>     /* only .sql file , not zip or gzipped files */ We can use this for local server  / shell access server only  not shared hosting server.

MySQL server gone away

Hello ,  If your project is using many modules especially big modules, may be you will also come across this problem. The problem was-                           I was uploading my database in abc.com, then it was giving following error.                            Error:  got a data bigger than max_allowed_packet                                                     While uploading database from abc.com to localhost the error was:                                                      Error:  MySQL  server gone away    ...

Video Tutorial For File Download After making payment

http://www. torontowebsitedeveloper.com/ category/video/ubercart

how to give "no link" or separator to menu in drupal

Special menu items is a Drupal module that provides placeholder and separator menu items. A placeholder is a menu item which is not a link. It is useful with dynamic drop down menus where we want to have a parent menu item which is not linking to a page but just acting as a parent grouping some menu items below it. A separator menu item is something like "-------" which is not linking anywhere but merely a mean to structure menus and "separate" menu items visually.

how to retrieve data stored in the database in different language and print in php, mysql or drupal

While retrieving the data stored in the  database in different languages, it will be retrieved as unknown format(???).   To avoid this problem and to retrieving the original values please use the below given code before your select query  mysql_query("SET NAMES utf8"); mysql_query("SET CHARACTER SET utf8");

To Hide "Log Message" or "Revision information" from node form in drupal

To Hide "Log Message" manually , use the below code in template.php function phptemplate_node_form ( $form ) {   // Remove 'Log message' text area    $form [ 'log' ][ '#access' ] = FALSE ;   return drupal_render ( $form ); } OR  use the below module http://drupal.org/project/removelogmessage

How to get the views datas inside coding in drupal

To get the view datas inside coding , Use the below coding    $display = 'page_1'; // 'page_2' or 'block_1' etc $view = views_get_view('view_name'); $vars['photos'] = $view->preview($display, arg ); $vars['photo_count'] = $view->total_rows; Note: arg should be array arg should he replaced by array($vars['row']->nid) if used template.php file templatename_preprocess_views_view_fields(&$vars) { }

How to retrieve drupal views content using PHP Code

use the following php code for retrieve drupal 6 views content: $display = 'page_1'; // 'page_2' or 'block_1' etc $view = views_get_view('view_name'); $display = $view->execute_display('block_1', $myArg); print $display['content']; ?>

How to Fetch Profile field Values in drupal

We can add additional fields in the user registration form using profile module. The following code is used to fetch these profile field values anywhere in drupal. <?php global $user; profile_load_profile ( $user ); print( $user -> profile_ [ fieldnam e ]); ?>

how to get drupal block contents(using coding)

We can display any Drupal block anywhere in the website using the code given below. <?php $block = module_invoke( [module name], 'block', 'view', [block id] ); print $block['content']; ?>  

CSS for mac

To write separate CSS for mac os ,Copy the below script into the head tag of your page <script type="text/javascript"> var csstype="inline" //Specify type of CSS to use. "Inline" or "external" var mac_css='body{font-size: 14pt; }' //if "inline", specify mac css here var pc_css='body{font-size: 12pt; }' //if "inline", specify PC/default css here var mac_externalcss='/style/macstyle.css' //if "external", specify Mac css file here var pc_externalcss='/style/pcstyle.css'   //if "external", specify PC/default css file here ///////No need to edit beyond here//////////// var mactest=navigator.userAgent.indexOf("Mac")!=-1 if (csstype=="inline"){ document.write('<style type="text/css">') if (mactest) document.write(mac_css) else document.write(pc_css) document.write('</style>') } else if (csstype==...

Text shadow in IE browser(css hack for text-shadow )

text-shadow: 0.01em 0.03em #000000; (For Firefix std browsers) filter: Shadow(Color=#000000,Direction=135,Strength=2);(For IE std browsers) -moz-text-shadow: 0 0 2px #000; (For lower level mozilla) -webkit-text-shadow: 0 0 2px #000;(For safari of lower version) 

New Object-Oriented Features in php 5

The following list provides the main new features:     public / private / protected: Access modifiers for methods and properties. Allows the use of common OO access modifiers to control access to methods and properties: class MyClass { private $id = 18; public function getId() {    return $this->id; }  } Unified constructor name  __construct(): Instead of the constructor being the name of the class, it is now declared as __construct() , which makes it easier to shift classes inside class hierarchies: class MyClass {                 function __construct() {                                 print "Inside constructor"; ...

Difference between Php 4 and php5

Difference in object assignment:     Example: class Person {   var $name;   function getName()   {     return $this->name;    }   function setName($name)   {     $this->name = $name;   }   function Person($name)   {     $this->setName($name);    } } function changeName($person, $name) {    $person->setName($name); } $person = new Person("Andi"); changeName($person, "Stig"); echo "Name is :". $person->getName(); Result: Php 4 :Name is Andi Php 5 :NAme is Stig Note: the ones who were aware of this problem , should have a sleepless nights trying to track down weird bugs that they could not pinpoint. Hope this blog will help most of the php4 developers

Quotes by Robin Sharma

"Wealth is not only measured by how much money you have, it is also measured by how much you are at peace within."      "The difference between your planning and action is the measure of your lack of perfection". They keep making their today better than yesterday. The best stars have infinite energy and appetite for stretching their personal frontiers and improve each and every area of their lives." "A man is as old he feels, the energy to keep improving keeps them young at heart and provides positive thinking mind body and soul." "Winners have two types of courage – the courage to act and the courage to endure – and they never quit regardless of the circumstances. Understanding that they are bigger than their circumstances is what gives them the courage to succeed." "Health is very important part of the whole system of causing immortality and longevity." "Blaming others is nothing more than excusing yourself.....

print_r() equivalent in jQuery

var my_object = new Object(); my_object["employeename"] = "Alex";  my_object["surname"] = "pandian"; my_object["sex"] = "M";   alert(data.toSource()); //Will give "({employeename:"Alex", surname:"pandian", sex:"M"})"   print_r() equivalent in jQuery, Romel Drupal, most popular equivalent in jQuery, romel jquery, jquery romel, javascript romel, romel javascript, javascript, jquery   //It might not work in <=IE6 

most useful functions in jquery

This Blog deals with the Quick look at the seven jQuery AJAX functions, That deal directly with AJAX transactions which are made to a remote server.     jQuery.get() : This function is the most generic of jQuery tools. It does a simple HTTP GET request from the server. The data that is passed into the callback function is in the form of a string. We used this function in the previous chapter and we will use it in the next project we do. There is a variation of this function, jQuery.getIfModified(), that does the same thing, but only invokes the callback if the returned document has changed since it was last loaded by this script.   jQuery.getJSON() : This function works like jQuery.get() with one difference. The returned data is treated like JSON data and is parsed into JavaScript objects. If you try to get XML content with this function, it will generate an error. jQuery.getScript() : This function also works like jQuery.get(), except that it...

How to add js file in module's info file

A very basic .info file for our new module:    ; $Id$ name = my_example_module description = "My Example Module"  core = 6.x Add one more line to our basic .info file. scripts[] = my_example_module1 .js scripts[] = my_example_module2 .js This line won't be used by Drupal, but will be used by our module: function my_example_module_init() {      $path = drupal_get_path('module', 'my_example_module');      $info = drupal_parse_info_file($path . '/my_example_module.info');      foreach ($info['scripts'] as $script) {             drupal_add_js($path . '/' . $script);      } } The above function should be return in the .module file (hook_init)  It will read the module's .info file and load any JavaScript files specified in the scripts[] directive and add to the site using drupal_add_js (hope know abou...