title: showing module code once when multiple joomla modules in same page
body: <p>In a joomla menu item page i placed same module instances multiple times(i duplicated in module manager).Now it's a severe requirement that some codes of my module have to be only one time in page.Because my module's each instance injects same code again and again.
  how to avoid it so that only some codes will appear in page only once when i have multiple module instances of my module in that same page?
  searching through web i found some unreliable ways - </p>
  
  <pre><code>1.Using session in module i track whether same module loading two or more times and restrict code injecting one time only
  2.using a constant like this way - 
  if(!defined('MODULE_ALREADY_LOADED')){
  //echo codes that you only want done once
  //this will set the constant and now the other modules won't load/echo the code
  define('MODULE_ALREADY_LOADED', true);
  }
  </code></pre>
  
  <p>But not sure how much compatible the 2nd way is with joomla 2.5 as well as joomla 3 versions !.If there is a better error free way to do this then provide to me asap.</p>