Hi, when I use external files (CSS, PHP, third party…) I don’t know where to place. Where is it the right and clean place.
suppose that main folder is where I’ve assets, css, images, protected…
In this path I inserted my JS folder with all jquery, bootstrap, lightbox, showloading etc… JS files. Is this OK? (sometimes I’ve CSS and image sub-folder for files linked to JS scripts)
In this path I inserted a server/php folder where I places UploadHandlder.php files and in /img sub-folder … the images linked to this script
in this path I inserted an “upload” folder where I’ll save all images uploaded by users
Question: I’ve CSS folder and Themes folder. When insert CSS files in Theme (css sub-folder of theme) and when in CSS folder placed in main path?
The /css folder is provided as a default folder and used by ‘blueprint css’ framework that is included with Yii. On regular development practices, you’ll create your own theme folder under /themes and store everything there, probably ignoring /css.
I typically create a special directory with user uploaded content, in parallel to /themes, /protected and so on. I don’t wish to upload the user content into the theme folder and see no reason to do so (on the contrary -t he theme is ‘my’ provided theme folder and should remain clean).
Best practices guidelines would recommend keeping /protected… protected and not accessible for write or read directly from the web. Other than that, consider separation between your resources and user uploaded resources. This is good for backup purposes as well.
This is all up to you though and what you decide to do on your project.
Regarding JS, you can definitely go with the suggested design. Be advised also that Yii shines when it comes to modularity. Hopefully, sooner or later you’ll start organizing your code into packages - extensions, modules, etc. Those packages, can carry their own ‘resources’ and those resources can be ‘published’ by Yii assets manager. Have a look in this well written wiki article for more details on the assets manager. Using such methodology, each package can carry its own basic css, js, images (etc) resources that are published by decision made in the package itself (for example, when a module or a widget contained within a module knows that now some resources should be referenced by the user - then it ‘publishes’ them).
Not sure I fully understood you ‘php script’ question. I guess this is plain functionality you refer to, rather than css, js, etc. In that case, its a different ball game and this deserves a new question in which you’d better describe that PHP code/functionality needed and ask for recommendations on how to pack it.