Saturday, April 07, 2007

Difference between <div> and <span>

1.The tag cant do any formatting of it's own.
2.It simply tells the browser which styles are applied whatever in the span tag.
3.It cant define any logical division of the document.


<div>

1.It includes the paragraph break.
2.it defines the logical division of the document.
AJAX stands for Asynchronous JavaScript And XML.

This technology is used to reduce the bandwidth and time of the user.

AjAX is combination of javascript and HTTP Request.In this technique the http request is created as xml (XMLHttpRequest).

if you want to use the technology called ajax,if you can create the XMLHttpRequest.
The below code is used to create the XMLHttpRequest.

function createXMLReq()
{
var XMLReq;
if(window.XMLHttpRequest)
{
try{
XMLReq = new XMLHttpRequest();
}
catch(e){

XMLReq = false;
}
}
elseif(window.ActveXobject)

{
try{
XMLReq = new ActiveXobject("micrfosoft.XMLHTTP");
}
catch(e)
{
XMLReq = false;
}
}

return XMLReq;

}

The above code is used to create the XMLHttpRequest.

using the open keyword you can call any serverside file with querystring.

For Example:

Req =
createXMLReq();

Req.open('method','url') - [method = Get/post][URL = Requested URL]

You can check the state of the Request by using the following code.

Req.onreadystatchange

You can get the response text by using responseText


There are several states are there.

0 - uninitialized.
1 - Loading
2 - loaded.
3 - Interactive.
4 - complete.







DOM (Document Object Model) in PHP5

In php5 DOM is an default extension.
It is used to create the xml/xhtml file in php.You can create the DOM object using the follwoing line.
$doc = new DomDocument();

By using the above object you can easily create the element by using the below code

$newEle = $doc->createElement('elementName'); [elementName - Variable]

After creating the element you can append the element as a child to other element.

$doc->appendChild($newEle);

The above code append the element as a child in the root.If you want to append the element as a child in particular element.
For example:

$dom = new
DomDocument();
$ele = $dom->createElement('html');
$chdEle = $dom->createElement('body');
$appEle = $ele->appendChild($chdEle);

$dom->appendChild($ele);

In the above code First the <html> and <body> elements are created,After that the body element is added as a child in html element.




Friday, March 02, 2007

Spell Checking

Spell checking is very easy to integrate in any site.

We can simply create a spell checker using php and ajax.

Pspell is the Extension in php, used to check the spelling of the word and also give the suggestions.

if you want to use pspell,first u can install aspell library in your system

after installation was completed.copy the pspell.dll and aspell.dll and put it in system32 directory or in the php directory.
After all are finised, add the
--with-pspell[=dir] option and compiling the php.

Now you can use the pspell functions in your website.

Thursday, January 04, 2007

Serialization and Deserialization.

serialize is a inbuild method in php .It is used to convert any object in to string.

Using unserialize() conveting the serialized string into its own format.

For example,

class serializeClass
{
public $fname;
public $lname;
public $email;

}
class serializeClass1 extends serializeClass
{
public $name;
}
$myserializeObject = new serializeClass1();
$myserializeObject->name = "prabhuname";
$myserializeObject->fname = "prabhu";
$myserializeObject->lname = "kalaiselvam";
$myserializeObject->email = "prabu@gmail.com";

if you want to convert the object "$myserializeObject" into string
,Using serialize () method u can convert it .


serialize($myserializeObject). the class object was converted in to string.

if u want to de serialize you can use unserialize($myserializeObject).

Tuesday, January 02, 2007

select user_id, user_fname, user_lname
into outfile 'prabu.csv'
fields terminated by ',' optionally enclosed by '"'
lines terminated by '\n'
from cwf_users


this is used to export the data as csv file and saved in
"C:\Program Files\MySQL\MySQL Server 5.0\data\prabu.csv" if you are installed mysql in c directory
If you want to change the file extension of your php file

AddType application/x-httpd-php ".new extension"

for example your site name is thinkpixels.net.If you want to use "tp" as your file extension,just add this line in your htaccess file
AddType application/x-httpd-php ".tp" 

try this.


Saturday, December 30, 2006

PHP 5 supports the xslt transformations. if you want to use this features ,you can add the xsl extension in php.ini file.

This extension is used for xsltprocessor. After enabling the extension,you can restart the apache server.then only the changes will be affected.

XPATH:

Is a language for defining parts of an xml.

xpath uses the following steps to select the node of the xml.

1.elements.

2.text

3.attributes

4. name spaces

5.processing Instructions

6.comments

7.document root


some wildcard are there in XPATH.

* - is used to retrive all the elements in the xml.
@* - is used to retrive all attribute nodes in the xml.

XML stands for extensible Markup Language

XML is a markup language like HTML.

It won’t have any predefined tags. You must define the tags.

XML was designed to describe data and to focus on what data is.

If you want to ignore some thing from the parser, you can use CDATA.


Namespaces are used to avoid the Name conflicts in XML.