I’m looking to port an existing application into Yii (currently old procedural PHP, but a functional and powerful app). I’m just learning Yii for the first time, so I don’t yet know what is easy vs. hard to do in a framework. One thing that I need to be able to do is allow each “client” of my database app to have their own database, directory area for uploaded files (photos and other), colors for the CSS, and possibly even “overrides” for some of the interface text (the app is bilingual, and I want to keep only one copy of the full translation files, but allow a way for specific terms to be custom for a client if necessary). The client is identified by the subdomain, and I use suexec to prevent any sneaky clients from accessing other clients’ file area.
The way I handle these things in my current code (because I hand-wrote it, so I have all freedom) is:
-
Database: connection details in small php file in the client directory that I simply include
-
Files: custom PHP files that serve binary content with the right header - e.g. [font="Courier New"][color="#8B0000"]<img src="photo.php?id=56">[/color][/font]
-
CSS colors: [font=“Courier New”][color="#8B0000"]<link rel=“stylesheet” href=“style.php” type=“text/css”>[/color][/font], then style.php includes a colors.php file in each client’s directory and serves up the CSS
-
Translation overrides: I haven’t implemented this one yet, but if I were continuing with my old code, I’d probably replace _(“string”) with __(“string”), and write function __($text) to check for a hit in a custom translation file first and then go to the regular gettext spot if not found
The question is: Can you point me in the right direction for any important clues I need early on for doing these kind of things within Yii? And if any of these will go against the “spirit” of Yii (or “buck the system”… use your favorite metaphor), I’d like to know earlier rather than later. I’m still deciding if I’ll be able to go with Yii or if I’m too much of a maverick and should just write my own OOP PHP without a third-party framework.