yeah i’m sure. but can i test it somehow?
yeah i’m sure. but can i test it somehow?
got it!
i had a look on my error logs from the apache. there i found, that apache was always trying to access the folder images directly after htdocs htdocs/images.
but my images folder is in my project folder. in my case aida32.
so i linked the images now like this:
CHtml::image('/aida32/images/login.gif')
and everything works fine.
is this a correct way? or should it be different?
You can do so, but then you hardcode the projects folder name into all CHtml::image() commands. So if you move your folder you will have to change everything. To prevent this, you could prefix all your image paths with Yii::app()->baseUrl. To make this shorter, you can use the helpers described here:
http://www.yiiframework.com/doc/cookbook/31/
They provide a method bu() that does this for you. Then you can write:
CHtml::image(bu('images/login.gif'));
thx mike. that’s great!
btw.
can somebody show my which functions the method app() has?
i couldn’t found anywhere an api for this.
because:
i’m coding with eclipse. i’ve include the yii framework there, so i can see all functions popping out in a list and have so an autofill in. but when i’m typing yii::app-> and use then the shortcut to show me some functions. i cant find for example the baseUrl or name or anything else.
so are these functions some where written down?
hope u guys understand me.
Check the documentation for this.
Yii::app() is a method that retrive the actual CWebApplicationinstance.
Yii::app() has the same functions that CWebApplication has.
why not call then directly CWebApplication?
This is a "singleton" implementation. See here for a description of this pattern: