Wiki

Articles tagged with "behavior", sorted by viewsX
Displaying 1-8 of 8 result(s).

Manage (Target) Language in Multilingual Applications + A Language Selector Widget (i18n)

Created 2 years ago by c@cbaTutorials10 comments – viewed 26,307 times – ( +15 ) – version 1.1
In case of a multilingual application, one might consider it a reasonable approach to store the preferred language of the user in a session variable, and after that, every time a page is requested, to check this session variable and render the page in the indicated language. This tutorial shows a Yii-way of doing this. We implement an event handler for the onBeginRequest event; as the name of the event suggests, this event handler will be called at the beginning of each request, so its a good place to check whether a language is provided (via post, session or cookie) and set the application language accordingly. We also implement a simple Language-Selector Widget, which can render the language options as ajax-links or as a drop-down list.

How to use an application behavior to maintain runtime configuration

Created 3 years ago by zaccariaHow-tos3 comments – viewed 23,473 times – ( +27 ) – version 1.1
In this tutorial will be explained a method to manage some configuration runtime. This excellent tutorial follows a similar approach, but requires to write a masterclass which all controllers are supposed to extend, following this wiki you can achieve the same by only editing the configuration.

How to implement an event and attach it in a behavior

Created about a year ago by seb7How-tos0 comments – viewed 9,772 times – ( +5 ) – version 1.1
This page explains how to implement an event and catch that event in a behavior.
tags: event, behavior

Rendering a view file in a console application

Created 2 years ago by TompiHow-tos1 comment – viewed 7,547 times – ( +3 / -2 ) – version 1.1
When someone want to send formatted HTML mails from a console application she/he will probably come across the problem of rendering view files.

CGridView: Adding behaviors from configuration, and template items from behaviors to CGridView

Created about a year ago by le_topTips0 comments – viewed 6,387 times – ( +5 ) – version 1.1
Changing the way a CGridView is rendered from the configuration file, or through behaviors specified at the moment it is used, is handy to extend a CGridView without creating tons of different classes for it. I am surprised that this is not in the default implementation, so I made my default CGridView implementation.

Fixing extensions without modifying their code

Created about a year ago by schmunkTips3 comments – viewed 5,593 times – ( +6 ) – version 1.1
If you're working a lot with extensions you often stumble upon problems, when you want to include them into your custom web application, like hardcoded or absolute path aliases or classes extended from core application components, which implement addiditonal features.

Save and Display Date/Time Fields in different formats in Yii2

Created 3 months ago by Kartik VHow-tos6 comments – viewed 3,305 times – ( +24 ) – version 2.0
You would find having such a need in most Yii Projects. Your database needs a specific format to store date fields, while you may want to display it in different formats to the users on forms and other views.

Auto-update denormalized attributes with MongoDb and Yii2

Created 6 months ago by edoardo849Tips0 comments – viewed 2,901 times – ( +1 ) – version 2.0
You have different collections in MongoDb with de-normalized attributes. As you may know, due to its not-join nature, MongoDb tends to encourage repetition of the same value in different collections (de-normalization). In this MongoDb is opposed to a more SQL-like approach where you usually reference only the ID of the value with a foreign key.