PHP

How to make any directory into a simple server using php built-in web server?

August 12, 2015 - 11:26

This article explains a relatively new feature in php; The Built-in web server. Other languages like python and ruby already had their own simple HTTP servers where you can convert you local folders/directories into a simple HTTP server (for python: python -m SimpleHTTPServer) which serves scripts and HTML files and basically does almost everything apache does. Almost!

How to run phpmyadmin without apache only using the php built-in web server?

August 12, 2015 - 10:57

Before reading this, please familiarize yourself in setting up a php built-in web server. Phpmyadmin is usually installed along with apache web server. Depending on the version of apache you may have some complications along the way. Fear not, for php has introduced something known as a built-in webserver! With this, you can convert any local folder into a server and host a site locally there.

An introduction to CodeIgniter

August 07, 2015 - 17:14

CodeIgniter is an open source PHP frame work with simple MVC pattern. CodeIgniter is lightweight, generates clean URLs and uses very simple template parser. CodeIgniter didn't require a specific template engine for website layout. Latest version of CodeIgniter is Version 3.0.0. It is a loosely coupled, faster, flexible and high performance system. It supported the database such as MySQL (5.1+), Oracle, MS SQL, PostgreSQL, SQLite, etc.

What are the different ways to set PHP Constants

May 07, 2015 - 14:30

A constant is a name for a simple value, which will not change at the time of execution. The main advantages are ranges from setting configuration values to saving integer values to be checked as strings (like status codes). PHP provides functions for constant values, which make the usage more easier. These functions are important in Drupal too, since we may need those when working in Drupal projects.

PHP number to word converter using Indian numbering system

December 08, 2014 - 09:15

I was faced with a requirement to convert number to words/string in Indian naming system with lakhs and crores. I had to generate the amount in words for printing it out on a bill. The total amount, provided to the customer, needed to be converted to string. For example, if 1345673 was to be converted to Thirteen lakh Forty Five Thousand Six Hundred and Seventy Three, these functions will have to be followed.

[PHP] How to read an XML using DOM

March 09, 2014 - 19:10

If you are a PHP programmer or a Web programmer you would eventually encounter a situation where you need to process XML. Since XML (Xtensible Markup Language) is a widely using format for exchange of information there are libraries to parse an XML file in PHP. Read on to know how to read an XML using DOM.

[Drupal] How to redirect users to different URLs on a Drupal site after Facebook login?

In one of our Drupal projects, we implemented a feature where, users can login to the site through Facebook login(fconnect button). Facebook login(Fconnect) button was implemented using fbconnect module. Client requirement was to change the landing page for each user according to their role after login through facebook.

Basics of cURL Requests with PHP

June 05, 2013 - 22:52

cURL is a very powerfull system which allows us to transfer data across a wide variety of protocols. cURL is commonly used to send data across websites which includes API interaction. Using a cURL request, we can do the basic HTTP request, the more complex FTP upload or interaction with an authentication enclosed HTTPS site.

[Drupal] How to update / modify the data submitted via Drupal webform when submitting the form?

Webform is a Drupal module that can help webmasters create submission forms like survey forms, contest forms, contact us form etc without any custom programming. Usually webform submissions will result in the data being inserted as a new row into table 'webform_submitted_data'. But our client requirement was to update an existing submitted data from the table 'webform_submitted_data'. If you want to know how to update an existing webform submission then continue reading

[Drupal] How to pass values from PHP to javascript in a Drupal site?

May 30, 2013 - 17:08

Are you looking for a way manipulate dom elements using javascript based on some values from PHP, then this article is for you. We had recently worked in a Drupal 6 site having the same scenario. Our requirement was to enable some checkboxes using javascript based on the values of some variables available in the backend, This was accomplished using Drupal.settings

[Drupa] Showing or hiding blocks in a Drupal site using custom logic with PHP

Blocks in Drupal can be assigned to regions in specified pages. Two options which are already in Drupal 7's block configuration page are:

  • All pages except those listed
  • Only the listed pages

And if you have enabled the PHP filter module, you may find another option:

  • Pages on which this PHP code returns TRUE (experts only)

In this article,I am going to explain to you, how you can display a block on pages based on the value returned by PHP code.

Pages