getthemepath not working

Permalink
Hi,

does anyone know why this:

<img src="<?=$this->getThemePath()?>/images/header_logo.png">

is turning out like this on the site:

<img src="<?=$this->getThemePath()?>/images/header_logo.png">

It's just like PHP aren't enabled, but it is, and everything else works perfectly. Problem occured when moving site to a new location.

 
vincedelaking replied on at Permalink Best Answer Reply
vincedelaking
Hi Don,

have your tried:

<img src="<?php echo $this->getThemePath(); ?>/images/header_logo.png


Best,
Vincent
DonRonito replied on at Permalink Reply
Thanks Vince, that sorted out the problem :). I find it strange though that on my other server it works fine with the codeline above, but on this other server I need to use <?php echo $this->getThemePath(); ?>.

I can understand that the <? short tag is not supported by my new hosting providers setup, but I do not understand why =$this->getThemePath() doesn't work. Long time since I've been writing PHP, so I'm not updated on new compatibility issues etc. Either way, your code worked fine! Thanks!
jero replied on at Permalink Reply
jero
Just in case you didn't spot the difference in vincedelaking's reply,

<? is a "short tag" and can be disabled in your webhost's PHP configuration.

<?php however, will always work.

For maximum portability, always use <?php.
DonRonito replied on at Permalink Reply
Hi Jero, you are correct that my new hosting provider has disabled the <? short tag. See my post above on how I find it strange to also having to change the code a little. The original code is something I got from the default C5 template. Thanks for your reply!