JUMI Code in Content

A multipurpose module, plugin and component

JUMI Code in Content

New postby gersh » Sat Mar 12, 2011 12:17 am

Hi,

I an creationg a Joomla site with two templates.
One in color and the other in black&white.
Because of this I have two templates built with color elements in one and b&w elements in the other.

Now I also need different photos / graphics in the content pages. For example color photos in the color template and b&w photos in ... right, the b&w template.

As it is not possible to write php code directly in the content pages, I took JUMI and made a php file with:

Code: Select all
<?php
defined('_JEXEC') OR defined('_VALID_MOS') OR die( "Direct Access Is Not Allowed" );

echo '<img src="templates/' . $this->template . '/images/picture1.png" border="0" alt="Link">';
?>


I have the different photo directorys under templates, so the code should create me the image path to the chosen template:
- templates/tmpl-color/images/picture1.png
OR
- templates/tmpl-bw/images/picture1.png

But it doesn't work. The script does not insert the template name. It is blank:
<img src="templates//images/picture1.png" border="0" alt="Link">

Does anyone have an idea whats wrong with the code?
Thanks a lot!
gersh
gersh
 
Posts: 5
Joined: Sat Mar 12, 2011 12:05 am

Re: JUMI Code in Content

New postby gersh » Sat Mar 12, 2011 12:43 am

Wow - I got it by myself:

Code: Select all
<?php
defined('_JEXEC') OR defined('_VALID_MOS') OR die( "Direct Access Is Not Allowed" );

$cur_template = $mainframe->getTemplate();

echo '<img src="templates/' . $cur_template . '/images/picture1.png" border="0" alt="Link">';
?>
gersh
 
Posts: 5
Joined: Sat Mar 12, 2011 12:05 am


Return to Jumi

Who is online

Users browsing this forum: No registered users and 2 guests

cron