Articles in category "how-tos", sorted by viewsX
Displaying 191-200 of 328 result(s).

How to customize error handling in console-mode applications

Created 4 years ago by Steve FriedlHow-tos1 comment – viewed 9,095 times – ( +3 ) – version 1.1
One can control the detail of a web application in the webroot/index.php file by manipulating the values of YII_DEBUG and YII_TRACE_LEVEL, but these don't appear to be used by console applications. This is because although the base CApplication class defines a displayError() method that does consider these variable, CConsoleApplication overrides it with a function that doesn't honor them.

How to create Module based Login

Created about a year ago by turiHow-tos1 comment – viewed 9,077 times – ( +3 ) – version 1.1
Lets say we have 3 modules (customer, user, admin) in an application and we need, separate logins for each module.

Extending CJuiDialog

Created 2 years ago by dstudioHow-tos0 comments – viewed 9,024 times – ( +2 / -2 ) – version 1.1
Sometimes you have CJuiDialog with different content but same buttons (or width, height). If you don't want to repeat yourself this is a great solution:

Limit a CGridView field to some preset length.

Created about a year ago by le_topHow-tos1 comment – viewed 9,007 times – ( +13 ) – version 1.1
Sometimes text inside a gridview column is just too long. That's why I figured out a way to make the column smaller while still providing the information.

Using Pear Mail Mail_Mime and Mail_Queue

Created 3 years ago by LorenHow-tos2 comments – viewed 9,001 times – ( +7 ) – version 1.1
Create a component (/protected/components/PearMail.php) Edit this as needed based on where you put the files from PEAR.

Upload files in Yii2 with MongoDb and GridFs

Created 11 months ago by edoardo849How-tos3 comments – viewed 8,900 times – ( +8 ) – version 2.0
Uploading files in a webapp can be extremely tricky and sometimes the quickest way to do it is to store the file directly in the webserver or into a DNS (like Amazon S3) and then to save the link and the metadata inside a table in the DB. The thing is that you'll have to deal with file permissions, server storage, file management and so on (which is perfectly fine, by the way).

Yet another implementation of CPhpAuthManager.

Created about a year ago by seenivasanHow-tos3 comments – viewed 8,879 times – ( +8 / -1 ) – version 1.1
In this wiki, I try to implement a simple authorization schema without putting much logic inside a file or into database table. We are constructing authorization hierarchy inside the controller. We are getting roles for the current user from database table and assigning only roles to user that are declared in the particular controller. We have brought down the work of loading of auth data at main application level to controller level. This way we have pulverised auth data for entire site into smaller units. Finally we are going to look at couple of examples.

Simple Web APIs for your Yii App

Created about a year ago by shivHow-tos4 comments – viewed 8,815 times – ( +2 / -2 ) – version 1.1
Its very common now-a-days to have Mobile app for web apps. For Mobile apps we need web APIs to fetch data or even post/update on web. We found a very simple method to make such interface. Mobile App can call plain get or post request and receive data back in JSON format. JSON is relatively easy for mobile app to handle while plain standard GET/POST request for easy for Web server to handle. This mixed approach saves lot of time on server side. We not really need to handle actual REST requests and still be able to exchange data between web and mobiles or ajax java-scripts or even node.js.
tags: API, JSON

Override/Eliminate Bootstrap CSS/JS for Yii 2.0 widgets

Created 11 months ago by Kartik VHow-tos2 comments – viewed 8,750 times – ( +30 / -4 ) – version 2.0
In Yii 2.0, the yii widgets that use Twitter Bootstrap CSS & JS directly, are part of the yii2-bootstrap extension, starting with yii/bootstrap namespace. For customizing bootstrap extension specific widget assets, you could configure your own assets (CSS/JS) using the new Yii Asset Manager in your Yii Config file. Something like:

ISA hierarchy of tables inside a database and how to implement a single form

Created 3 years ago by pligorHow-tos2 comments – viewed 8,693 times – ( +1 ) – version 1.1
Please consider the following Dear software engineers imagine I have a simple ISA hierarchy: parent A with children B and C. So let's say we have the corresponding tables named "a", "b", "c" and (created with the help of the gii model creator) the classes A, B, C The following is a screenshot from MySQL workbench: