Hi,
first: I am a total newbie to Yii.
second: I’ve been coding in php for several years now, creating a webbased app, that is in productive use. I would call myself advanced in php and mysql, but not a pro.
Until now, I never used a PHP-Framework. My app is getting a bit old (codewise) and I want to make a fresh start. To speed things up, I thought I’d use a framework. After researching and trying a while I settled for yii.
After successfully installing, going through the ‘getting started’ section and browsing through the Definite Guide, it’s still hard for me, to understand some of the basic concepts of how MVC really works, and what I have to do step by step, to make things work. I hope it’s not tiring for you pros, if I start asking some dumb sounding questions.
Until now, my app consisted of an index.php, which routed the request to different modules, which means includes where triggered based on the GET-Request sent. It always included several general classes, for example a ‘config.class.php’, a ‘db.class.php’, a ‘sec.class.php’, a ‘log.class.php’, etc… all in which classes with methods and properties were defined and later on used. Systemwide variables were stored in SESSION and before any header was sent, all data was collected, either a html-Output or a pdf-Output using fpdf (or an AJAX-Request, which then was rerouted). At the very end of the ‘index.php’ the output was triggered. The app uses TWO (!) database connections, and all personal data in both databases is BINARY encrypted. The first database contains among other information the decryption-key for the second database.
-
Question: Is yii working basically the same way? Would the file ‘web\index.php’ be the equivalent to my ‘index.php’?
-
Is there a need to create a controller for every database-Table, and in that controller, would I have to create all functions for retrieving, updating, securing, encrypting, decrypting and filtering data?
-
My database consists of many tables with minimal information, these tables are very often connected through indizes, to retrieve data. I often use "INNER JOIN’-Statements to retrieve data from many tables (up to 4, I think) in one request. How would I have to do this in yii? Can there be a controller for the database, like I used a class with many mehtods to retrieve data?
-
How would I tell yii not to load a view, but rather use fpdf, to create a pdf-File in a new browser window?
-
Where would I put such a routine: “On every loading of the page, test, if there is at least one user in the database-table ‘user’. If not, load a page, that gives the opportunity to create a user. If there is at least one user, and there is no active login, present a login page. If there is at least one user, and a valid user is logged in, present the regular homepage with different menue items.” - A How to-Guide to these Questions would make yii a lot clearer for me, than the satellite-type ‘Getting Started!’, describing single concepts without tying them to the great picture (no insult intended, it’s just my simple mind, that may not be able to tie the given knots together).
Answers to these questions would be very appreciated and would get me started.
Thanks a lot!!
hbergman