Want to get the path to the current template in Joomla? IIRC, the $mainframe global object is eventually going away. Here is a way to do it through the framework:
$app = JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.