Php string functions

addcslashes — Quote string with slashes in a C style addslashes — Quote string with slashes bin2hex — Convert binary data into hexadecimal representation chop — Alias of rtrim c [...]

Php array sorting

Let say an array is $myArray=array(10,20,50,27,18,32,133); Sort this array to descending to ascending order. To achieve this, we have to use the php predefined function "sort". Example: < [...]

Determining if a word is a palindrome in php

A palindrome is a word or sentence that reads the same forward as it does backward. The words a and I are perhaps the simplest and least interesting palindromes; the word racecar and the na [...]

How to reverse a string in PHP using for loop

Let say a string is " MyNameIsJanaki". We have to reverse it which will display as "ikanaJsIemaNyM" Step1. Declare a variable in php as $mystring="MyNameIsJanaki"; Step2. Now what we will do is, [...]

Magento useful functions cheatsheet

Get host name: <?php  echo Mage::app()->getFrontController()->getRequest()->getHttpHost();?> Get base direcrory:  <?php echo Mage::getBaseDir();?> Get base URL: <?php [...]

Magento category navigation or vertical category menu in sidebar

Step1. PHP Code to retrieve top level categories for navigation and save it at the following location. in short this file contain code related to catalog Navigation Model which retrieves top level ca [...]

How to Set, Retrieve and Unset Magento Session Variables

To set a Magento session variable: $myValue = 'Hello World'; Mage::getSingleton('core/session')->setMyValue($myValue); To Retrieve: $myValue = ''; $myValue=Mage::getSin [...]

How to create a new module in Magento

Folder Structure for a new module in Magento. Step1:  Create a new namespace inside app/code/community  folder. namespace is nothing but a folder or directory  name which can be easily  ident [...]

Magento installation problem “innoDB storage engine is not supported”

Problem: The installation of Magento gives with the connection to the database following report: “innoDB storage engine is not supported”. This is common  problem in Magento ver. [...]

Magento DataFlow