Category Archives: Website Design and Development

info and code blocks for use in website design and development

Set Custom Titles in Magento

To set a custome or forced title in Magento you need to first edit the head.phtml file from this:

<title>< ?php echo $this->getTitle() ?></title>

to this:

< ?php echo ($this->getForcedTitle()) ? Mage::getStoreConfig('design/head/title_prefix').' '.$this->getForcedTitle().' '.Mage::getStoreConfig('design/head/title_suffix') : $this->getTitle() ?>

and then in the various layout xml files add this in the relevant sections:

<reference name="head">
<action method="setForcedTitle"><title>Account Dashboard</title></action>

MySql Search / Select

Use this to search through the SQL records and then do something with each relevant record

$sql = “SELECT *
FROM table_name
WHERE email = ‘{$email}'”;
$rs_result = mysql_query ($sql, $conn);
while ($row = mysql_fetch_assoc($rs_result)) {
$new_id = $row[‘id’];

Convert Date to English Date PHP

Heres my function to convert the wrong american date format to the correct English date format, to use it simply add it to a php file and include it in your script. Then to use it do something like this:

$english_date = english_date($american_date);

/// function to sort date to English
function english_date($date){

$explode_date = (explode(“-“,$date));

$english_date = $explode_date[2] . “-” . $explode_date[1] . “-” . $explode_date[0];

return $english_date;