Displaying all products and new products listing in column/grid layout – Zen-cart

Exactly before one year, I was doing a shopping cart project in Zen-cart. I had to display ‘All Products’ and ‘New Products’ listing in column/grid layout. The default layout was row layout. Then I searched if there was any addon which could help in my problem. But I couldn’t find any. The response that I … Read more

How to fix row height in zen-cart product listing?

Almost one year back, I had problem with the product display in Zen-cart. I searched for help in zen-cart forum. I started a topic over there. But at last, I myself had to post the solution on that thread.. coz, I found the solution. ;) I just wanted to include that problem and solution in … Read more

PHP: How to get (view) html source code of a website

Here is the PHP code to fetch the html source code of any website specified. fopen function is used to open the website URL. stream_get_contents is used to read the opened URL. The fetched code is displayed inside a textarea. $domain = 'http://example.com'; $handle = fopen($domain, 'r'); $content = stream_get_contents($handle); /** // alternative to stream_get_contents … Read more

PHP: Generate random number and string

Here are code samples to generate random number and strings in PHP. Generate random numbers between 1 and 1000 $num = rand(1,1000); Using mtrand() function for better random number generation $num = mt_rand(1,1000); Generate a unique combination of numbers and letters. Works with PHP5 and higher. $unique = uniqid(); Using md5() and uniqid() function to … Read more

PHP: Validate Email, Name, Price, Age using Regular Expression & filter_var

This article contains PHP code with regular expression to validate different numbers and strings. Integer validation can be done for validating age. Decimal validation can be done for validating price. Simple String validation can be done for validating name. Email validation can be done for validating email. preg_match PHP function is used to perform the … Read more

Making a tree navigation menu in PHP

Below is the code with sufficient comments on making a tree navigation menu (hierarchical menu) in PHP. A single page holding different links. The navigation links are present at the left sidebar of the page. I have not used any dynamic approach over here. Have not used any loop. It’s just a static and straight-forward … Read more