Cannot Figure Out baseURL and folders

I apologize in advance for being completely dense, but I do not understand OOP in action (I understand the principles, but when faced with OOP code, a fog envelops my brain), and I do not understand yii.

I am trying to put an image on my index page. I gather that you use CHtml::image($src, $alt, $htmlOptions). As the value for $src, you are supposed to use:

Yii::app()->request->baseUrl . ‘/path/to/image.jpg’

I cannot for the life of me figure out what actual folder on my server baseURL points to. When I echo dirfile(FILE), the result I get is:


So I made a folder in site called images.

I put <?php echo CHtml::image(Yii::app()->request->baseUrl . ‘/images/mypic.jpg’) ?> in the index.php file, and I get the broken image icon.

I have a decent handle on procedural PHP, but my brain is so far unable to make the jump to OOP. I had the same issue with C++ decades ago.

Hi, this dir holdes your views only, not assets.

Your baseUrl usually points to your webroot directory. So there is a place for a folder like images. Do not put assets in your protected folder unless you are using them with asset manager to publish them in your webroot.assets.


Thank YOU.

Now I think I understand how the process works, so I should be able to replicate it.