Wiki

Articles in category "how-tos", sorted by commentsX
Displaying 91-100 of 354 result(s).

Run Yiic directly from your app without a shell

Created 5 years ago by jacmoeHow-tos6 comments – viewed 32,918 times – ( +18 ) – version 1.1
Sometimes it would be nice if we could run yiic from an action, for example a migrate database button in our admin panel. Or because you are on a host which doesn't have shell access. Or maybe you are not allowed run popen or exec.

Use CGridview to sort and filter CSqlDataProvider - when used with UNRELATED tables (or complex queries)

Created 2 years ago by Gerhard LiebenbergHow-tos6 comments – viewed 15,584 times – version 1.1
I have two tables called hospitals and departments. I have a junction table between them which holds the departments in each hospital. But sometimes I need a list of "All hospitals with All possible departments" - regardless of whether they are linked in the junction table or not.

AssetManager: clearing browser's cache on site update

Created 4 years ago by dhampikHow-tos5 comments – viewed 35,747 times – ( +19 ) – version 1.1
If you like the things to be short and clear, then you can skip right to a short summary of instructions at the end of this article.

CGridView keep state of page and sort.

Created 4 years ago by DanielHow-tos5 comments – viewed 26,986 times – ( +6 ) – version 1.1
Remember-filters-gridview is one of the must-use extension on all of my project. However, it lacks of storing the page and sort variables of the grid view.

Displaying image in a CGridView column.

Created 4 years ago by sirin kHow-tos5 comments – viewed 60,833 times – ( +13 / -1 ) – version 1.1
This is a simple example of how we can display images in CGridviews.Imagine that you have an image field in your table ie either a location field or a blob type field used to store the images.
tags: CGridView, image

CSV Export

Created 4 years ago by JohnPollardHow-tos5 comments – viewed 16,839 times – ( +4 ) – version 1.1
I needed a csv export function for my cgridview and I wanted to export the entire result set of the sorted and filtered cgridview the user was viewing via ajax.
tags: csv, export

Using SQLite and CDbMessageSource as a module

Created 4 years ago by pheadeauxHow-tos5 comments – viewed 14,393 times – ( +5 ) – version 1.1
There are scenarios when you work with DVCS (like Mercurial or Git) and CDbMessageSource. To my experience keeping the development database and production database in sync can be very time consuming. Plus, when working in a team, you never know when the database was updated.

Take more control of CGridview and model searching (related model or another controller)

Created 2 years ago by Kostas Apazidis (KonApaz)How-tos5 comments – viewed 29,938 times – ( +5 ) – version 1.1
Suppose you have an Application in Yii that manages hotels each one has many customers.

Dynamic Sidebar using CClipWidget

Created 5 years ago by SheldmanduHow-tos5 comments – viewed 26,977 times – ( +21 ) – version 1.1
Most applications will have one or two sidebars and often you want to control the content that should appear in the sidebar based on the action. For example you will want to show something different on the homepage as opposed to some view page. While achieving this you generally also want to avoid putting the layout into each view, as that would mean if you wanted to change the layout (e.g. put the sidebar on the left instead of the right or do some funky layout which requires an additional div tag to be added) you'd have to go through every view, which does not achieve good code re-use. It is also bad practice to have lots of if statements in column2 layout just so that you can generate the sidebar correctly.

X-Sendfile - serve large static files efficiently from web applications

Created 5 years ago by Maurizio Domba CerinHow-tos5 comments – viewed 59,675 times – ( +26 ) – version 1.1
Normally when we want users to download a file, that file is put in a folder under the web application root and the web server does the rest.