Add a custom variable in Magento and pull it in a .phtml template or externally in PHP

Log into your Magento admin. Go to Admin > System > Custom Variables.

Fill in Variable Code with an identifier for the custom variable. For this example we’ll use “my_variable”. Complete the other required fields. Add the text you want to display in “Variable Plain Value”.

In your .phtml template, add the following lines:

$custom_variable = Mage::getModel(‘core/variable’)->loadByCode(‘my_variable’);
echo $custom_variable->getValue(‘text’);

If you want to access it in a stand-alone external PHP file then create a .php file with the following contents:

<?php

require_once ‘app/Mage.php’;
umask(0);
Mage::app(‘default’);

$custom_variable = Mage::getModel(‘core/variable’)->loadByCode(‘my_variable’);
echo $custom_variable->getValue(‘text’);

?>

x.Commerce Innovate Conference 2011

On October 12-14 I was fortunate enough to attend the X.commerce Innovate 2011 Convention in San Francisco.  They really went above and beyond to present everything in an structured, fast-paced format that was loaded with excellent speakers providing the latest information about X.commerce and how it relates to Magento, Paypal, e-Bay, Facebook and many others.  The most exciting parts for me were the Beta certification test on Thursday and the XDevCamp (Magento) on Friday with Vinai Kopp.  Apart from just being in beautiful San Francisco, they made each day informative and well-balanced.  To top it off, the food was excellent.  I look forward to attending Innovate 2012!  Thanks to Ben Marks (Blue Acorn), Vinai Kopp (Magento), Karen Baker (WebShopApps), Susie Sedlacek (Magento) and to everyone else who took the time to make me feel welcome!  You guys are the best!  While I was in town I visited SecondLife HQ and got to meet one of the Linden system administrators.

 

IMAG1710 IMAG1703 IMAG1726 IMAG1942
Riding in an open-top double-decker bus over the Golden Gate Bridge was freezing cold but worth it.

IMAG1776 IMAG1778 IMAG1770 IMAG1730
That’s me in the black shirt with my back facing the camera on the screen 🙂

IMAG1710