I’m new at working with frameworks and Yii is the framework I chose to start with. Anyway, I have a basic question as I try and figure out the basic design concepts.
Our company has multiple websites and multiple locations, so we end up with multiple pages that share information, such as phone numbers and addresses. I’d like to have that information stored in one place in our database, so if a phone number changes I can change one record and have it updated on any page that displays that phone number.
This information would not be the primary page content. What would be the preferred method to pull that data? e.g. create a new instance of each model that I need data from within the controller, perform standalone queries within the controller, etc?
Thank you in advance.
I normally have a Model per Table set. Nevertheless, I highly recommend you the lecture of:
They will explain to you the basic concepts of MVC structure and also a good tutorial on Yii AR power capabilities.
Cheers and welcome to the forum
I prefer to put company phone, address and stuff into params section of my config, so i can access it via Yii::app()->params[‘paramName’].
You can also connect to multiple database, for obtain the data of the application from a database and the data shared from another.
Take a look here.
Thanks for all of the help. I have to say I like the idea of using params for that type of information. Many of the pages it will be displayed on will not require a database connection, so I’d hate to need one just for that.