img src get theme path
Permalink
Hi, my menu on pagewww.www.madisonbusinesssolutions.co.uk... 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.
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?
Thanks
Jack
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?
Thanks
Jack
If I understand you correctly...
First off, your menu script file will need to have the extension .php
Second, try:Some servers don't support the <?= short-hand PHP.
First off, your menu script file will need to have the extension .php
Second, try:
<img src="<?php echo $this->getThemePath(); ?>/image/photo.png" />
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.
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]
[code]<?php echo $this->getThemePath(); ?>images/myFile.gif[code]
instead of
[code]<?php = $this->getThemePath(); ?>images/myFile.gif[code]
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?
Kate