I’m creating view files in a folder in themes folder and using the layout file main.php. Different pages have different javascript files and stylesheet included in the head tag. How do I work out with this ? Include those in the content file or layout file ? If I include it in the content file then it will appear inside the body tag of the resulting page because main.php has the header, menu and footer of the whole website
put it in your view: you may then use CClientScript::POS_END (or else) to register your js files in the footer (after your other scripts referenced in protected/layouts/main.php), and POS_READY (or else) to register your js scripts in the $(document).ready() jQuery function
or put it in the main layout with some condition on controller and action ids, this could be interesting if these files are repeated through many views