Posts

Showing posts from February, 2011

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...