Here is a small guide how to get console commands running inside modules & extensions. For this guide I used a fresh yii2 basic application template.
Here is a small guide how to get console commands running inside modules & extensions. For this guide I used a fresh yii2 basic application template.
This How-To is useful if you are planning to move the Yii vendor directory outside the default location.
It is difficult to perform user dependent theming through a general configuration in 'main.php'. This article proposes a method to do so through a Factory that dynamically generates classes to allow delayed resolution of actual user values. This means that you can refer to values that are stored in the database through the CActiveRecord before Yii is actually loaded. The values will be fetched...
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)
Note the tag {{homeUrl}}
will be dynamically replaced at runtime.
If you develop your Yii project on both Windows and Mac, there can be a problem setting up the configuration unless the configurations for both system are identical. On my machines I have the following configurations:
I guess this is a tip on how to execute some code before every action in a controller, because I will tell you how I did it and maybe you can use the idea in your project.
You may face a situation when you need to access to a configurable module's property from everywhere and you don't have an instance of this module's class.
In many cases developers of one project use their own local environments for coding. There may be a common test platform and, of course, production. All these environments usually have different DB credentials and directory structures (first of all, path to YII framework directory). Another feature is debugging. It's convenient to turn it on for local environments, eventually - on the test s...
YiiBackboneBoilerplate, aims to provide Yii Backbone developers with an application folder to ease the startup of their projects. It uses the flexibility of our YiiBoilerplate with a twist for BackboneJS applications.
Even though it looks complicated at the beginning, you will find that it is not that hard as it seems once you understand its structure. Yii's project structure wiki obviously inspired a lot of this setup, and you will find that some of the paragraphs here are taken from their wiki.
I was wondering how to set-up the application parameters in the back-end to use them all around the application without the need of using the database and I came up with this solution, I hope it helps somebody else.
I like programing on my localhost, however it really bugged me to make changes to index.php & config files on my production server. After combining all available wiki articles on this topic and some trial and error this is what I use for my applications so I could just upload it to production server and it will work without any changes.
In this article, we describe the directory structure used by yiiframework.com - the official Yii framework website. While this structure may look overly complicated for small projects or may not be optimal in some sense, we believe it is appropriate for medium or large projects in a team development environment. In fact, we have successfully used the similar structure in some other big projects.
Occasionally one wishes to set systemwide parameters for an application, such as a contact address for email, an application name, or setting an option that guides major behavior. Yii provides for setting of static parameters in the configuration file, and this article talks about how to do it conveniently.
Yii's by-default directory organization works well enough, but there are several steps one can take that improve the security and serviceability of the system, especially in the context of multiple Yii projects on the same machine (including multiple versions of the same project).
After enabling the Gii module in your protected/config/main.php
file and then try to use it with http://example.com/index.php?r=gii
, you get an error:
~~~
Error 403
You are not allowed to access this page.
~~~
This is almost certainly caused by the IP filtering mechanism that Gii uses to protect your system from outsiders - by default it allows localhost
only (both IPv4 and IPv6), and r...
Application configuration determines how an Yii application should behave, because it is the only parameter passed in the entry script. An application, on the other hand, needs to behave differently under different circumstances. For example, an application may need different configurations when running in production mode, development mode and testing mode; In a team development environment, each...