Did you know FaceySpacey is the creator of Redux-First Router and Universal?

The Startup Incubator.
Your one stop social media shop
Resource Categories:

Technical
Non-Technical
Refer A Friend
Popular Articles
DEVELOPMENT TOOLS 1 - VERSION CONTROL (Mercurial)
CONTRACTING 2 - TOP 10 EASY SITE CREATOR TOOLS
Subscribe
Yii 1 - INTRO TO FRAMEWORKS
Typically now, you’d be introduced some raw MySQL. The reality is to get productive you can skip to using a framework that will “abstract” all the MySQL code you’d have to type. To get advanced, you’ll most definitely have to master SQL (“Standard Query Language”). But keep in mind we’re on the fast track to getting productive and getting the general-to-specific understanding of the entire scope of what you need to know...By the way “abstract” means in layman’s terms to make coding easier by creating a layer on top of deeper code that makes the most common tasks easier. So frameworks provide a precise toolset (i.e. set of code commands you can type) that handles the most common tasks you will need to execute without having to know all the internals. The result is you get to remember a lot less coding commands to accomplish major things.
The framework we recommend is Yii, which is the best PHP framework around right now as of August (2011). period. Don’t waste your time researching all the different PHP frameworks available. Just learn and master Yii: http://www.yiiframework.com .
Yii is an MVC framework. That means it's based on the "Model View Controller" designer pattern. We'll cover each of these 3 aspects in depth in the following Yii tutorials. For now let’s start with an example of the most important part, the Model, so you can get an idea of the power of the Yii Framework to inspire you to continue your study of it. We’re going to create an Article class, which is essentially the template for model objects to be generated from:
class Article extends CActiveRecord { public function tableName() { return ‘article’; } public function getInfo() { echo ‘The book, ‘.$this>title.‘ has ‘. $this>pageCount.‘pages<br>’; } }
Ok, so notice, we did not define the “title” and “pageCount” properties. The reason is because this Article class automatically grabs these properties from columns in your article table in the database. We’ll cover SQL later, but real quick: the idea is a database is a series of spreadsheets with column headers, rows with similar data, and cells that hold the data that correspond to the current column each are in. So the idea here is that Yii simplifies how your PHP code works with the database. It inherently knows the columns of the corresponding table, and provides them as properties for all Article objects that extend from the Article class.
How does this happen? Well, through inheritance. This Article class you created extends CActiveRecord, which is a class within the Yii Framework. That means you have access to all the pre-built tools it provides. That’s it. By the way the Article class is called a “model”--it’s the “M” in “MVC.” It automatically models database tables.
So it lets you do things like tack on the getInfo() method and not have to do anything else to start getting results.
That’s the end of this lesson. The takeaway is that you create your classes by extending from classes in the Yii framework, and a whole lot of work is automatically done for you. I explain how to install Yii in Server Setup 3 - Installing Yii & Your Application, but the basic idea is you associate the application you’re working on with your installation of the Yii Framework, and now you can reference classes, methods, etc, from the library of code provided in the Yii Framework.
Comments

SMM 3 - FORMULA TO FIND INFLUENCERS