February 16, 2009

Creating a Simple User Class in PHP

Most modern languages support object-oriented programming techniques, and PHP is no exception. Although many simple web development projects do not require an object-oriented approach, larger projects often do. When I'm developing a web application, and I have the choice of the programming technique to use, I normally opt for an object-oriented approach of some sort, even though I might not use all of the object-oriented capabilities made available to me by PHP.

In this article, rather than describing what objects and classes are, I'll look at a simple example which hopefully will show how you can use an object-oriented programming technique when you are developing web applications.

Consider the following very simple HTML file.

index.htm

[html]

[head]

[/head]


[body]

[p]Welcome[/p]

[/body]

[/html]

Note: the use of square brackets instead of angle brackets is simply to ensure that the tags are not processed as HTML.

If you create and open this file in a browser it will display the word 'Welcome'. To turn this into a piece of object-oriented software we could produce the following two files.

index.php

[?php

// Include the file containing the User class

include ('user_class.php');

// Create a new instance of the User class

$newUser = new User;

// Call the welcome() method

$newUser->welcome();

?]

user_class.php

[?php

class User {

// Methods

function welcome() {


print "[html]";

print "[head]";

print "[/head]";

print "[body]";

print "[p]Welcome[/p]";

print "[/body]";

print "[/html]";

}

} // End of User class definition

?]

If you open index.php in a browser, it will also display the word 'Welcome', but this time it is done by creating a new instance of the User class ($newUser), and then calling the welcome() method, which is contained in the user_class.php file. Obviously, for a very simple web site like this, an object-oriented approach is way over the top, but you could add new methods to the user_class.php file to, for example, enable users to register and to log on, and so on. You could then call the methods you are interested in from index.php or from any other web pages that you create.

For example, if you create a method that checks whether a user is logged on, you could call that method from any page for which you wanted to provide access control. So if we wanted to add access control to index.php, we could change the files to:

index.php

[?php

// Include the file containing the User class

include ('user_class.php');

// Create a new instance of the User class


$newUser = new User;

// Call the checkAccess() method

$newUser->checkAccess();

// Call the welcome() method

$newUser->welcome();

?]

user_class.php

[?php

class User {

// Methods

function checkAccess() {

Code would go here to either log the user on, or to check that he/she is still logged on.

}

function welcome() {

print "[html]";

print "[head]";

print "[/head]";


print "[body]";

print "[p]Welcome[/p]";

print "[/body]";

print "[/html]";

}

} // End of User class definition

?]

If the web application allows users to, for example, create documents or upload photos, you could create new classes for those requirements. This way, you can build large, complex, applications that are easily maintainable.

Joomla Web Development Services

Joomla web development services are the talk of the day. It has many features that overall provide ease-of-use and extensibility to user. Anywhere, anyone can make use of Joomla open source solutions. Joomla is used all over the world to make powerful websites with innovative solutions. You can easily infuse your designing ideas here and provide a "good site" to the visitors and the search engines as well.

Joomla has thousands of extensions and is highly extensible, which are available in Joomla extensions directory (and most of them are free under GPL License). Hence, for getting an exclusive site designed and developed you can make use of Joomla Web Development Services offered by the web development and designing company. They have team of designers who can make the effective utilization of tools available on Joomla. They make professional and aesthetic custom web design that in nutshell represents your organization.

By using this program web site builders can easily make corporate web site portal, Corporate intranets and extranets, Online magazines, newspapers, and publications; Government applications; E-commerce and online reservations Small business Web sites; NGO Web sites; Community-based portals; websites for institutions (both religious and educational), personal homepages and much more.

You might be thinking what about the content and other related things. Well Joomla program takes care of all this. It has the feature to add simple text, documents, audiovisual tracks/snippets, books or anything you can think of. Since, Joomla is easy to use, now many e commerce companies, web designers and developers are using this service for quickly making great websites. By using Joomla web development services, clients can maintain their site themselves as minimum instructions are written there.

January 10, 2009

Custom Web Applications Development

The web applications are built for providing variety of solutions for a variety of businesses. The custom software applications make the business to be more dynamic and flexible that allows competition in the high performance business world. Custom Software Development is a practical approach to solve problems connected with Software development. Clients want their projects to be unique. Their ideas can be put into practice with the help of new technologies and approaches to solve all the related problems, and finding new creative solutions in order to meet the specific requirements. The preferences to client's necessities and preferences is the key idea of custom web application development.

The process of custom web development involves planning strategically in advance for the project. There is the combination of domain expertise and the latest advanced technologies for developing effective applications. All the processes are streamlined to increase the operational efficiencies. All these methods reduce the deployment cycle time and cost and provide a faster rate of return. It gives special emphasis on scalable web application development. A scalable web application development can have room for the rapid business changes with ease in the future too.

A customized web application development resulting out of the vision of the client results in higher productivity with the information well managed in an effective manner. It leads to the reduction in the cost and smooth running of the business processes. The applications can be developed in multiple technologies like java, java script, ASP.NET, Python but the selection of the right technology keeping both the present and the future in mind is most important for developing customized applications. A well built application surely gives the client a winning edge over the competitors.

Rakhi Chowdhary is a SEO strategist, SEO executive, SEO copywriter at a software development, web development, open source development company. She deploys SEO tactics to ensure high ranking on major search engines. Her articles, blog posts, content will help blogs, articles, and web site content readers to learn more and broaden their knowledge base.

Techgrowth, is an software outsourcing company savvys your business needs by providing elite software solutions, outsource its services globally.