Add UNIX fortune to admin footer

Last modified by Discovery on Thu, June 24, 2010 17:03
Source|Old Revisions  

UNIX fortune has been around for a while - 1979 to be exact. To add fortune to your admin footer you will need to install fortune on your system (yum install fortune works with Fedora/CentOS, apt-get with Ubuntu) and then add this line to the top of your app/design/adminhtml/default/default/template/page/footer.phtml file:

<p><em><?php nl2br(passthru('/usr/bin/fortune -a')); ?></em></p>

The use of nl2br does not format the fortune cookies as they should look on a PDP-11 however they will be in reasonable HTML. Full formatting is for another coding adventure.

The -a option is for all fortune files, including those in the offensive directory. These probably do not exist yet, so you may want to either a) get rid of the -a option in the line above or b) take up the opportunity to add in your own ‘funnies’, hopefully not too offensive.

To do this create the directory /usr/share/games/fortune/off and then make a text file in it called ‘off’. Open this file in your favourite text editor (hopefully ‘vi’) and put in your motivational quotes, one per line, delimited with another line containing the percent character, e.g.:

I would love to change the world, but Varien have yet to release the source code.
This feature is not currently on the roadmap but you are more than welcome to add it as a request in the Requested Features forum.
When I win the lottery I am going to buy the Enterprise (Edition of Magento).
Easter Eggs R Us
All your SKUs belong to us
Today I am going to add some Related Products
The Magento API is really easy to use, said the snail to the tortoise
When I am done with this project I am going to write a wiki article for the community

When done change into the off directory and type:

strfile -r off off.dat

To test your quotes type ‘fortune off’ from the command line, this should just pull from your ‘off’ file of extras.

Now load your admin pages and you should get some classic unix-style quotes and your added extras.

Note: this wiki page is open for adding motivational quotes. All entries regarding Magento, Open Source, pesky clients and such like are welcome, so long as they are 103.76% positive about Magento.