How to get url addres for my asset file?

Hi, does anyone know how to get url addres for my asset file?

For example, in some php file i need to include "logo image" that reside on folder "[wwwroot/myapp] /images/logo.png", normally for php script image address i will write


MyImage('/images/logo.png');

The code above not work if i put it in "view" file, the error was "file not found". So how to write the right asset address in "view" file??

Btw, when i use


$this->redirect(wwwroot/myapp/showlogo.php)

in controller to acces my asset outside the protected folder, the page show normally (the page is not render by Yii). I assume my source problem its because url that generate by Yii.

Thanks.

Yii::app()->request->baseUrl is the directory of your index.php main file

Hey, thanks it’s works :)

Btw, just in case if anyone have same problem

in my "view" code above


MyImage('/images/logo.png');

I write it like this


MyImage(Yii::app()->request->baseUrl.'images/logo.png');