Joomla getBuffer tutorial

Joomla is something i like and don’t like for various reason but nevertheless i would like to guide you over a very useful feature joomla provides when you have your own modules/components doing some functionality in addition to joomla.

Say, you are using custom library which provides data or stores data and performs various operations in backend. Now say you have encountered some random error or perhaps an information that you would like your beloved user to know about or as feedback from system (well specified in Human-Computer Interaction guidelines).

Lets assume you have a function that saves some information in your own custom DB(not joomla DB) and you want user to know on next page that information was saved successfully.

public function letssave($yourparams="default value"){
//lets get the global app object 
global $mainframe;

//lets call random hypothetical functions
       $mainframe->enqueueMessage("User your input has been processed successfully");
       //return to next page
   else {
       $mainframe->enqueueMessage("User your input has Failed for unknown reason");
       //return to next/previous page


Now you have all the code you need to enqueue your feedback messages using mainframe/Application object

Here’s how you can easily retrieve on your pages.

$doc =& JFactory::getDocument();
$buffer = $doc->getBuffer('message');
  // put some HTML code in here

Thats it. Now your users are well informed and upto date and there are no communication gaps between functionality and system feedback

Let me know how it goes for you….