main.php and models


how can i use models into main.php?

I have an application with different images that can be visualized into the application main.php.

So i would like to randomply retrieve one of those images.

How can i do that?



Have you tried creating an extension?

You could make a component that will pull in the proper random images, then add that to your yii application config







Then in the layouts/main.php file where you want that random display, call


where drawImage() is the name of the method that outputs your random image.

The other option would be to make a widget for it.

Thanks so much!

It works great!