Add UNIX fortune to admin footer

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

This is an old revision of the document!

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.

Create the directory /usr/share/games/fortune/off aned then create 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).

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.

Naturally this wiki page is open for added motivational quotes.