Jump to Navigation

015 - XMLHTTPRequest for all browsers

You need to create a script that will correctly create an instance of XMLHTTPRequest object regardress of which browser you are using . A good solution to this problem is to have your script try in turn each method of creating an instance of object, until one such method succeeds.


function getXMLHTTPRequest()

var request = faulse;

try{ request = new XMLHttpRequest();  /* e.g. Firefox */ }



014 - Drupal Custom CSS & JavaScript

We can append a custom CSS and JavaScript to your own module. We  instruct the theme system to include the module's CSS and JavaScript files along with the other stylesheets and JavaScript libraries Durpal will list in the HTML it sends to the clients.



013 - About jQuery

jQuery is one of the most innovative JavaScript libraries to come around. Using an Object-Oriented design pattern called Fluent Interface, jQuery makes it possible to chain a sequence of function calls together to construct queries. jQuery query is used to query the DOM tree.

A DOM(Document Object Model) tree is a data structure that defines the structure of a document -- usually an HTML or XML document. DOM is known for its complex object model. jQuery provide an API that is mode compact and easier to use.


012 - How to print a label from Zebra printer

This is a sample program in order to print a label from zebra printer.
Once You make printer codes in a LBL file, You can print it by shell_exec().



011 - The t() Function

t() is the translation function. It is used to provide multi-language support and also provide a standard method of string substitution. When t() is called, Drupal will check to see if the user's preference language is other than the default(US English). If the user prefers another language, and that language is supported, then Drupal will attempt to translate the string into the user's preferred language.



010 - To Connect MySQL

This is a sample to connect MySQL DB.


mysql_connect("localhost", "username", "password");


$result = mysql_query("SELECT * FROM user_table");

if ($result && mysql_num_rows($result)) {

$numrows = mysql_num_rows($result);

$rowcount = 1;

print "There are $numrows people in user_table:<br /><br />";

while ($row = mysql_fetch_assoc($resiult)) {

009 - Searching and Filtering with XPath

The standard way to search through XML documents for particular nodes is called XPath. XPath is much easier than regular expressions for basic usage.


$XML = simplexml_load_file('employees.xml");

echo "<strong>Using direct method....</strong><br />";
$name = $xml->xpath('/employees/employee/name');
foreach($names as $name) {
echo "Found $name<br />";
echo "<br />";


008 - SimpleXML

PHP offers several different ways of parsing XML, but as of PHP5, the most popular way is to use the SimpleXML extention. SimpleXML works by reading in the entire XML file at once and converting it into PHP object containing all the elements of that XML file chained together in the same way. Once the file has been loaded, you can simply pull data out by traversing the object tree.


$employees = simplexml_load_file('employees.xml');


007 - Drupal functions for development

The following functions are used for drupal module development.
You should change "hook" of function name to the module name you are creating.

* hook_menu()

* hook_user()

* hook_nodeapi()

* hook_install()

* hook_uninstall()

* hook_schema()

* hook_action_info()

* hook_block()

* hook_help()


006 - To connect MS SQL Server

This is a sample program for connecting to MS SQL Server.


Subscribe to LAMP, Database and Cloud Technical Information RSS

Main menu 2

by Dr. Radut