Wiki

Articles in category "how-tos", sorted by viewsX
Displaying 31-40 of 350 result(s).

How to setup RBAC with a php file

Created 6 years ago by bettorHow-tos17 comments – viewed 61,549 times – ( +26 / -5 ) – version 1.1
In this cookbook I will attempt to explain how to use the lightweight version of Role-Based Access Control using a php file. This version does not use database but a php file and is controlled by CPhpAuthManager class.

How to translate and do the translations the easy way

Created 4 years ago by Roman SolomatinHow-tos3 comments – viewed 61,113 times – ( +28 / -2 ) – version 1.1
I wanted to keep all the I18N related translations in separate files, so that I would not need to modify the view files or the model files every time I need to update or fix the translations of application's source language.

How to hide /frontend/web in url addresses on apache

Created about a year ago by raminiousHow-tos13 comments – viewed 60,653 times – ( +15 ) – version 2.0
There is an issue on Yii2 to redirecting / urls to /frontend/web. In other words we need a way to hidden /frontend/web from addresses. We will do this without changing Apache configuration and creating virtual host or setting document root (It's good for share hostings that we have not access to apache.conf)

How to log and debug variables using CWebLogRoute

Created 5 years ago by Antonio RamirezHow-tos8 comments – viewed 60,069 times – ( +18 ) – version 1.1
I have seen a couple of articles about how to integrate external libraries to debug our PHP code (i.e. firePHP) but after you read this article you will realize that there is no need for such libraries when using Yii.
tags: Logging

Using standard filters in CGridView custom fields

Created 5 years ago by GOshaHow-tos4 comments – viewed 59,445 times – ( +17 ) – version 1.1
In this article I'll try to explain how to use standard quick search fields in CGridView with customized columns.For example: We have a record in a database with field switch having 0 or 1 values. After that we want a user to see on or off instead 1 or 0. So we do the usual thing:

Displaying image in a CGridView column.

Created 4 years ago by sirin kHow-tos5 comments – viewed 58,183 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

Using setFlash for displaying various kind of messages

Created 5 years ago by TrejderHow-tos6 comments – viewed 57,792 times – ( +4 / -5 ) – version 1.1
In this short how-to I will show how to customize setFlash() to display messages (flashes) styled to be success confirmation, error report or notice information. And how to achieve displaying errors in other way.
tags: flash, error, message

Render Form in popup via AJAX (Create and Update) with ajax validation & Also load any page via ajax Yii 2.0 (2.3)

Created about a year ago by skwordenHow-tos6 comments – viewed 55,264 times – ( +20 ) – version 2.0
There are a few issues with the other solutions I originally used that I found from other wikis. I address the issues I had in this much simpler and shorter way. I am also going to explain what is going into way more detail than others to help people understand what's going on.

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

Created 5 years ago by Maurizio Domba CerinHow-tos5 comments – viewed 55,099 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.

Using Yii with Nginx and PHP-FPM

Created 5 years ago by LericHow-tos10 comments – viewed 54,509 times – ( +18 ) – version 1.1
This config is built on an Ubuntu 11.04 server. Software is nginx, php-fpm (php5-fpm). For performance, it's recommended to run php-fpm in SOCKET mode, instead of accessing via IP:PORT. That is the method shown below.