Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the path to the current template in Joomla 1.5?

Tags:

I'm writing a component and would like to insert images from the template folder.

How do you get the correct path to the template folder?

like image 586
nickf Avatar asked Dec 19 '08 01:12

nickf


3 Answers

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();
like image 51
jlleblanc Avatar answered Sep 20 '22 16:09

jlleblanc


What kind of path... On filesystem:

$templateDir = JPATH_THEMES.DS.JFactory::getApplication()->getTemplate().DS;
like image 26
Alexey Sviridov Avatar answered Sep 20 '22 16:09

Alexey Sviridov


I've figured out one method. Use the global $mainframe object.

$templateDir = $mainframe->getBasePath() . "templates/" . $mainframe->getTemplate();

Is there another (better) way?

like image 3
nickf Avatar answered Sep 24 '22 16:09

nickf