How to get the path to the current template in Joomla 1.5?
Asked Answered
T

3

24

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?

Tunstall answered 19/12, 2008 at 1:59 Comment(0)
N
34

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();
Namhoi answered 19/12, 2008 at 15:49 Comment(1)
and how do you get the administrator template?Underwater
J
6

What kind of path... On filesystem:

$templateDir = JPATH_THEMES.DS.JFactory::getApplication()->getTemplate().DS;
Joscelin answered 23/3, 2009 at 5:10 Comment(0)
T
3

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

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

Is there another (better) way?

Tunstall answered 19/12, 2008 at 2:11 Comment(1)
Looks to me as if this is the best way.Edison

© 2022 - 2024 — McMap. All rights reserved.