img src get theme path

Hi, my menu on contains images on the dropdown. The images are currently located with a standard url in img src. I would prefer to have the images in the images folder in the theme instead. I have tried using without success the following code,result being no image is displayed.
img src="<?=$this->getThemePath()?>/image/photo.png">

The menu is a file menu.html which default.php links to using php include.I have tried renaming menu.html to menu.php but this makes no difference.

Does anyone have any ideas?


View Replies: View Best Answer
s2d replied on at Permalink Best Answer Reply
Hi Jack,

Couple of questions:

Is the image directory in your theme directory called "images", or "image"?

Also, is your menu.html include in the same directory as default.php or any other template file that includes it?

ijessup replied on at Permalink Reply
If I understand you correctly...

First off, your menu script file will need to have the extension .php

Second, try:
<img src="<?php echo $this->getThemePath(); ?>/image/photo.png" />
Some servers don't support the <?= short-hand PHP.
JackRoyleMBS replied on at Permalink Reply
Thanks for you responses, had already resolved the issue, silly mistake the folder was infact images and not image. Too much staring at code makes my brain shut down.
negs replied on at Permalink Reply
I know this is solved, but for those still having problems, for my code, I had to have an echo in there. so,

[code]<?php echo $this->getThemePath(); ?>images/myFile.gif[code]

instead of

[code]<?php = $this->getThemePath(); ?>images/myFile.gif[code]