YiiHaa Webdevelopment blog about Yii-framework and more

1Mar/1258

Models and multiple database connections

Posted by martijn

By default, Yii uses the 'db' component for the interaction between your model and database. But Yii also supports multiple database connections. To use multiple database connections requires come configuration. In this blog I will explain how to configure multiple databases, preparing your models and use gii for creating models from all databases.

28Feb/121

Serving large static files using Yii

Posted by Klaas

Earlier I explained how you can use X-SendFile to serve large static files more efficiently using PHP and Apache. Serving the files with PHP (and Yii) is really easy and I will explain how to do this after the break. 

17Feb/1211

Validate unique constraints with more then one attribute

Posted by martijn

Yii comes with bucket of validators including a unique validator which validates whether an attribute value is unique in the corresponding database table. But what if your database unique constraint contains more than one attribute?

16Feb/120

Serving (large) files

Posted by Klaas

Ever served large files with PHP? I bet you loved that! Do not worry, I have good news for you! There is a solution (or improvement, whatever you want to call it) to the old way of serving files, which used to look sort of like this:

14Feb/120

CacheDependency, a real cache dependency

Posted by martijn

Using cache dependencies enables you to be in control of your cached data. Yii provides several dependency methods such as database, file and globalState.

They all work fine but when I use memcached as caching provider, I do not want Yii to check dependencies located on the hard drive everytime Yii::app()->cache->get() is called

13Feb/126

Minify and merge your CSS and JavaScript

Posted by Klaas

It is good practice to optimize CSS and JavaScript for lower load time, it is never good to have a lot of <link ref="stylesheet" href="...> or <script src="...> tags in <head>.