Google Ads

Proudly Hosted on

About Me

Hi, I 'm Aditya, the guy behind this website and many other. This site acts as my web playground, where I share all about me, my work and my knowledge.

I have over 8 yrs hands on experience in PHP, Mysql, JavaScript, open sources CMS like Joomla, Wordpress etc. During these 8 years, I have worked on more than 200 projects and/or websites but could not spare time for my blog.

 

 

Posts Tagged ‘PHP’


 Shorthand for asynchronous JavaScript and XML, is a group of interrelated web development techniques used on the client-side to create interactive web applications. With Ajax, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page.

The use of Ajax techniques has led to an increase in interactive or dynamic interfaces on web pages. Data is usually retrieved using the XMLHttpRequest object. Despite the name, the use of JavaScript and XML is not actually required, nor do the requests need to be asynchronous.

AJAX is based on the following web standards:

  • JavaScript
  • XML
  • HTML
  • CSS

AJAX uses the XMLHttpRequest object

To get or send information from/to a database or a file on the server with traditional JavaScript, you will have to make an HTML form, and a user will have to click the "Submit" button to send/get the information, wait for the server to respond, then a new page will load with the results. Because the server returns a new page each time the user submits input, traditional web applications can run slowly and tend to be less user-friendly.

With AJAX, your JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object.

With the XMLHttpRequest object, a web page can make a request to, and get a response from a web server – without reloading the page. The user will stay on the same page, and he or she will not notice that scripts request pages, or send data to a server in the background.

To demonstrate the AJAX PHP connection we will create a very simple form with 2 input fields. In the first field you can type any text and we will send this text to our PHP script which will convert it to uppercase and sends it back to us

HTML code

<body>
	<form name="testForm">

	Input text: <input type="text" onkeyup="doWork();" 
	name="inputText" id="inputText" />

	Output text: <input type="text" name="outputText" 
	id="outputText" />

	</form>

</body>

1. First step

 // Get the HTTP Object 
 function getHTTPObject(){ 
 
	if (window.ActiveXObject) 

 		return new ActiveXObject("Microsoft.XMLHTTP"); 
  	else if (window.XMLHttpRequest) 
 
		return new XMLHttpRequest(); 
 
	else { 
 
		alert("Your browser does not support AJAX."); 
		return null; 
		} 
	}

2. Second Step

// Implement business logic 
 function doWork(){ 
 	 httpObject = getHTTPObject(); 
	 if (httpObject != null) {  
	 	httpObject.open("GET", "upperCase.php?
		inputText="+document.getElementById
		('inputText').value, true); 
		httpObject.send(null); 
		httpObject.onreadystatechange = setOutput; 
		} 
	 }

3. The last step on client side is to implement the setOutput() function which will change the value of our second field.

  • 0 = uninitialized
  • 1 = loading
  • 2 = loaded
  • 3 = interactive
  • 4 = complete
// Change the value of the outputText field 
 function setOutput(){ 
 	 if(httpObject.readyState == 4){ 
	 	document.getElementById('outputText').value 
		= httpObject.responseText; 
		} 
	 } 

 

Implementing the server side functionality is very simple compared to the client side. In the PHP code we just need to check the $_GET super-global array. Afterwards convert it to uppercase and echo the result. So the PHP code is this:

<?php if (isset($_GET['inputText']))
      	echo strtoupper($_GET['inputText']);
      ?>
SocialTwist Tell-a-Friend More
Tags: , ,   |  Posted under Ajax, PHP, Technology  |  Comments  Comments Off on AJAX
Last Updated on Saturday, 15 May 2010 11:54

Development of PHP scripts without a preconceived plan to manage them is asking for a headache. The goal of a framework is to make the process of writing web-based applications simpler.

An application designed around MVC is easier to manage because it is split into tiers, which allow for independent development. This promotes code reusability by building models, which are reusable throughout the application.

What makes a good framework?

A good framework is easy to learn, simple to use, intuitive to work with, easy to extend or to modify, rapid to build (maintain) applications with and of course stable.

Various Frameworks

1. Cake Php

2. CodeIgniter

3. Zend

4. Yii

5. Symphony

6. Prado

7. Akelos

Cake Php – A  rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.

Website:- http://www.cakephp.org

More

CodeIgniter – CodeIgniter is an Application Development Framework – a toolkit – for people who build web sites using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.

Website:- http://www.codeigniter.com/

More

Zend – Extending the art & spirit of PHP, Zend Framework is based on simplicity, object-oriented best practices, corporate friendly licensing, and a rigorously tested agile codebase. Zend Framework is focused on building more secure, reliable, and modern Web 2.0 applications & web services, and consuming widely available APIs from leading vendors like Google, Amazon, Yahoo!, Flickr, as well as API providers and cataloguers like StrikeIron and ProgrammableWeb.

Website: http://framework.zend.com/home

More

SocialTwist Tell-a-Friend More
Tags: , , , ,   |  Posted under MVC, PHP  |  Comments  Comments Off on Php MVC frameworks
Last Updated on Sunday, 13 December 2009 09:40

 

PHP

Project  ? Current Stable Version  ? License  ?
AgilePHP 0.2a GPL
Atomik Framework 0.9 MIT
PRADO 3.1.6 revised BSD
CakePHP 1.2.5 MIT
Drupal 6.14 GPL
CodeIgniter 1.7.2 BSD-style
F3::PHP Fat-Free Framework 0.3.1 Creative Commons
Joomla 1.5.15 GPL
Helix 1.0 GPL
Horde 3.2 LGPL
e107 0.7.16 GPL
eZ Components 2009.1.2 BSD
FUSE 1.2 MIT
Kohana 3.0.1 BSD
KumbiaPHP 0.5 BSD / GPL
LISA 0.2.1 GPL
Mambo 4.6.5 GPL
PEAR 1.4.0 PHP / Various
PHP For Applications 3.2.2 LGPL
PHP ActiveRecord 3.2.2 MIT
PHP Work 1.2 MIT
Qcodo 0.4.2 MIT
QCubed 1.1 MIT
Seagull 0.6.6 BSD
SilverStripe (Sapphire) 2.3.2 BSD
SPIP 2.0.9 GPL
Symfony 1.4.0 MIT
TYPO3 4.3.0 GPL
[Yii][3] 1.0.10 BSD
Zend Framework 1.9.6 BSD
Project Current Stable Version License
SocialTwist Tell-a-Friend More
Tags: , ,   |  Posted under MVC, PHP  |  Comments  Comments Off on Comparision of various MVC Frameworks
Last Updated on Sunday, 13 December 2009 09:51
MVC

Model–View–Controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model.

In simpler words-

1. Model handles all our database logic. Using the model we connect to our database and provide an abstraction layer.
2. Controller represents all our business logic i.e. all our ifs and else.
3. View represents our presentation logic i.e our HTML/XML/JSON code.

SocialTwist Tell-a-Friend More
Tags: ,   |  Posted under PHP  |  Comments  Comments Off on MVC
Last Updated on Monday, 2 November 2009 03:07

What is Joomla?

Joomla is an award-winning content management system (CMS), which enables you to build Web sites and powerful online applications. Many aspects, including its ease-of-use and extensibility, have made Joomla the most popular Web site software available. Best of all, Joomla is an open source solution that is freely available to everyone.

 
SocialTwist Tell-a-Friend More
Tags: ,   |  Posted under Joomla  |  Comments  Comments Off on Joomla
Last Updated on Monday, 2 November 2009 03:28