Help Using CHtml::image to add a site logo for the layout

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>

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.

Just add the baseUrl in front of the image path… like:

<?php echo CHtml::image(Yii::app()->request->baseUrl."/images/logo.gif","ballpop"); ?>

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>

This works! Thanks!!

thnx it works…