private function _get_current_template_path()
{
$result = "";
$currentTemplate = craft()->templates->getRenderingTemplate();
$templatesPath = method_exists(craft()->templates, 'getTemplatesPath') ? craft()->templates->getTemplatesPath() : craft()->path->getTemplatesPath();
$path_parts = pathinfo($currentTemplate);
if ($path_parts && isset($path_parts['dirname']) && isset($path_parts['filename'])) {
$result = $path_parts['dirname'] . "/" . $path_parts['filename'];
if (substr($result, 0, strlen($templatesPath)) == $templatesPath) {
$result = substr($result, strlen($templatesPath));
}
}
/* -- Handle the below condition by using mysql_real_escape_string() instead, for performance reasons */
/* -- Make sure this template actually exists
if ($result && !craft()->templates->doesTemplateExist($result))
$result = "";
*/
return $result;
}