web development

PHP Regular Expression tool.

I was trying to create a php code to parse some text and to process it.

I have difficult time with the substr (sub string), strpos (which return the position of a particular segment of string). Testing and debugging it is just a time consuming work.

Luckily my friend enlighten me by introducing me regular expression way to look for values in a text. Using regular expressions you can easy find a pattern in a string and/or replace it if you want.

BUT PHP regular expressions seems to be a quite complicated area especially when I am not a experienced Unix user.Historically regular expressions were originally designed to help working with strings under Unix systems.

The regular expressions basic syntax

To use regular expressions first you need to learn the syntax of the patterns. We can group the characters inside a pattern like this:

  • Normal characters which match themselves like hello
  • Start and end indicators as ^ and $
  • Count indicators like +,*,?
  • Logical operator like |
  • Grouping with {},(),[]

An example pattern to check valid emails looks like this:

Code:
^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$ The code to check the email using Perl compatible regular expression looks like this:
  1. $pattern = “/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z.]{2,5}$/”;
  2. $email = “abcd@mydomain.com”;
  3. if (preg_match($pattern,$email)) echo “Match”;
  4. else echo “Not match”;
The syntax is not easy derive when you are not familiar with it. After googling around, I found http://regex.larsolavtorvik.com
This AJAX tool allows you to enter sample text string and your pattern string. The tool is able to execute it on the fly and shows result immediately. It will also print out the PHP source code. This really save my time from hard coding pattern and test string.

About author : This original article is property of Top 10 Web Hosting (http://www.top10webhosting.com). List of best web hosting services company offering PHP and MySQL. Compare & save ! on web hosting fee.

Note : Please include author information if you wish to republish this article.

List of top web CMS.

Here is a list of a few popular Open source Web based Content Management system (CMS).

  • CMSimple
    CMSimple is a free content management system. It aims to be simple, small and fast. As it is written in PHP it runs on Linux/Apache servers, or on Win32 with Apache or IIS. It doesn’t require any databases and it recommended for small site with less than 2MB text.
  • Cyclone3
    Cyclone3 is a free, open source modular content management framework and content management system engine. It is the first open source CMS using Mozilla Application Framework and has XUL administration frontend. It is licensed under the GNU General Public License.
    Cyclone3 requires Perl and MySQL DB.
  • DotNetNuke
    DotNetNuke is an open source web application framework written in VB.NET for the ASP.NET framework. The application’s content management system is extensible and customizable through the use of skins and modules, and it can be used to create, deploy, and manage intranet, extranet, and web sites.
  • Joomla!
    Joomla! is an award-winning Content Management System (CMS) that will help you build websites and other powerful online applications. Best of all, Joomla! is an open source solution that is freely available to everybody.
    Joomla! requires PHP and MySQL DB.
  • Mambo
    Mambo is a full-featured content management system that can be used for everything from simple websites to complex corporate applications.
    Mambo requires PHP and MySQL DB.
  • OpenCMS
    The fully browser based user interface features configurable editors for structured content with well defined fields. Alternatively, content can be created using an integrated WYSIWYG editor similar to well known office applications. A sophisticated template engine enforces a site-wide corporate layout and W3C standard compliance for all content.
    OpenCMS requires Java and works on most databases.
  • WordPress
    WordPress CMS started in 2003 with a single bit of code to enhance the typography of everyday writing and with fewer users than you can count on your fingers and toes. Since then it has grown to be the largest self-hosted blogging tool in the world, used on hundreds of thousands of sites and seen by tens of millions of people every day.
    Wordpress requires PHP and MySQL Db.
  • XOOPS
    XOOPS is a program that allows administrators to easily create dynamic websites with great content and many outstanding features. It is an ideal tool for developing small to large dynamic community websites, intra company portals, corporate portals, weblogs and much more.
About author : This original article is property of Top 10 Web Hosting (http://www.top10webhosting.com). List of best web hosting services company offering PHP and MySQL. Compare & save ! on web hosting fee.

Note : Please include author information if you wish to republish this article.

Add chart to your webpage with Google Chart API.

Are you looking for charting tool for your presentation on web pages ? Google Chart API may be just right for you.

The Google Chart API lets you dynamically generate charts using Google Server resources. To see the Chart API in action, open up a browser window and copy the following URL into it:

http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

Other examples of chart you can create.

All the examples above are created on the fly on google server. If you would do it from your web hosting account, it would have eat up a lot of your server resources. Why not just leave it to Google API chart ?

Restriction :- NO restriction, as long as you do not abuse it. No limit on number of times you call the API, but you are advised to inform google in advance if you use more than 250k times in a single day.

Check out the detail API on http://code.google.com/apis/chart/ on how you can use it.

About author : This original article is property of Top 10 Web Hosting (http://www.top10webhosting.com). List of best web hosting services company offering PHP and MySQL. Compare & save ! on web hosting fee.

Note : Please include author information if you wish to republish this article.

Next »