swampone
(Shawnsonnier04)
March 29, 2011, 4:43am
1
This should be simple but I’m scratching my head. Trying use a logo in my layout, and I’m using CHtml::image to load the image. Problem is that its not finding the image. I have it stored in /views/layout/images/logo.gif. Is this the correct way to retrieve this image?
<div id="logo"><?php echo CHtml::image("/images/logo.gif","ballpop"); ?></div>
elbek
(Elbek Kamoliddinov)
March 29, 2011, 5:34am
2
Where are you writing this code? Where is situated .php file. give me path. Try this code
<?php echo CHtml::image("../images/logo.gif","ballpop"); ?>
. if it dosn’t works, See via firebug. FireBug tell you.
mdomba
(Maurizio Domba Cerin)
March 29, 2011, 7:23am
3
Just add the baseUrl in front of the image path… like:
<?php echo CHtml::image(Yii::app()->request->baseUrl."/images/logo.gif","ballpop"); ?>
zaccaria
(Matteo Falsitta)
March 29, 2011, 7:56am
4
Also, the whole protected directory is protected, so images cannot be served.
Save them in the folder images and use:
<div id="logo"><?php echo CHtml::image(Yii::app()->request->baseUrl."/images/logo.gif","ballpop"); ?></div>