Below I have created an Html helper with methods to help me locate directories of my assets dynamically. Such assets may include CSS, JavaScript and images.

<?phpclassHtml{/**
* Makes the given URL relative to the /image directory
*/publicstaticfunctionimageUrl($url){returnYii::app()->baseUrl.'/images/'.$url;
}/**
* Makes the given URL relative to the /css directory
*/publicstaticfunctioncssUrl($url){returnYii::app()->baseUrl.'/css/'.$url;
}/**
* Makes the given URL relative to the /js directory
*/publicstaticfunctionjsUrl($url){returnYii::app()->baseUrl.'/js/'.$url;
}}

Methods like the above can be useful for including assets on the client-side. You can use it like in the following: