views:

129

answers:

1

Okay, so I've created a custom template for Joomla, and gotten that working. However, I'm wanting to create a custom option for displaying modules within the template. I found that if I create the appropriate function in the /html/modules.php file in my template I can make a

<jdoc:include type="modules" name="menu" style="myCustom" />

call in the template to show modules using that chrome.

That works fine, however I run into the problem that the chrome function wants to use some images from the template itself. In the template index.php file I have been accessing images in the template folder by

<img src="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/images/logo.png" alt="My Logo" />

but the $this object doesn't seem to work in the modules.php file. How can I get access to the $this object that the template was using (I think that's the current View object, but not sure), such that I can get those parameters? Or how best should I refer to an image in the templates directory without hard-coding it with the folder structure my site has?

A: 

You can do in your chrome function something like this:
<img src="<?php echo JURI::base(); ?>/templates/<?php echo JFactory::getApplication()->getTemplate(); ?>/images/logo.png" alt="My Logo" />

Cesar
That worked swell; thanks!
MidnightLightning