JUMI Code in Content
First unread post • 2 posts
• Page 1 of 1
JUMI Code in Content
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:
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
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
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
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: Bing [Bot] and 5 guests