Keyboard key codes detect with JQuery

JavaScript is one of the best Server Scripting Language for client side programming and JQuery is one of its library. JQuery is widely used by designers because it’s providing a lot of functionality just with few easy steps well I am not talking here about the designing part; we are talking about the keyboard key detection.

JavaScript Methods to Detect Keyboard keys:

There are three methods to detect the key codes of keyboard.

  1. keyup
  2. keydown
  3. keypress

If we are talking about the cross-browser compatible then keyup and keydown are the best solution for this.

Read More

Access Cross Domain feeds with PHP

Now easy to access and display cross domain feeds with php. With the use of DOMDocument() class we can easy access the feeds. In this given example I have fetched only the title and the link from the feeds. First of all start with the path from where you want to access the feeds, make sure that your path will be full with the complete URL, like I have mentioned on the given example. Then simply access the Tag of that feed/xml file with the member function getElementsByTagName(), and follow the code :

Read More

Ajax based contact form

If you want to make an application which respond quickly without refreshing the page then, JSON(JavaScript Object Notation) and AJAX(Asynchronous JavaScript And XML) combination is great to achieve that. In this post we are making a simple Ajax based contact form which respond the result in JSON format that we want, and with the help of jquery we display the JSON data.

Through AJAX we are sending the contact form data to a php file(submit_contact_form.php) and then getting the response as an JSON format, but as you see that in my php file, i didn’t used the ‘json_encode()’ function, the reason behind this is ‘json_encode()’ require PHP5 or above. But in this example i created the same format with the help of ‘echo’ that will work for me in PHP4.4.9 too.

So, Here is the HTML structure for the contact form, just put this structure inside the body tag.

Read More

Main difference between constructors in php

We are using OOPS(Object Oriented Programming System) in PHP because it is more flexible and reliable then Procedural Level language. In this section you will come to know how to define constructor in PHP.

Here are two way to define constructor, As you can see in the given example a class has been created with the name Student.

Read More

Image upload and resize with php

There is a lot of things that we want to do with in less time and working properly. Lets take an example to resize an image, for doing this first of all we need an image edit software and then open that image and resize and at the last save. That will take a lot of time, I am not talking here about image editing software or how to edit an image. I am talking about how to resize an image with php. Obvisioly if you want to edit an image then Adobe Family’s products are far batter whose provide you a lot of functionality.

Now lets come to the point, Before starting let i tell you a bit about this image resizing class. First of all we need to verify an image means get the file extension and check whether it is an image or not. I allow only .jpeg, .jpg, .gif, .png files. After that we have to check the image size, then set the image width and height according to real image, so that the quality of an image remain same, means not stretch when we resize it. Then simply genrate a new image that’s it.

Read More

Read RSS Feeds with SimpleXML

RSS(Really Simple Syndication) is used to distribute updated web content of the website to all over the world. It is generally used by those who updated his work over the web such as blog entries, news bulletins, audios or videos. RSS basically a Standardized XML format which allow publishing the data on the web and easily reading by any programming language Like Java, .NET, PHP etc. RSS provide benefit to there user who want to get the favorite latest information from subscribed website.

Here is an example to read RSS feeds with SimpleXML. SimpleXML is a extension of PHP that allow users to read or manipulate xml data. If you want to use this extension then you have to use PHP5 or grater then.
Read More