Comments (7)
There are many ways to do this, and they are mostly about how to maintain the configuration files, which is beyond the scope of the core framework. Still in our template applications, we will provide some solutions.
I'm closing this because the core framework will not deal with this.
from yii2.
I have another issue with configurations. I often wanted to use functions and variables like Yii::app()->controller->createUrl()
or Yii::app()->baseUrl
in the configuration, eg. for jQuery plugins. Will there be something like placeholders for that?
from yii2.
You should rely on alias to achieve this. For example, '@www/path/to/file.js'
would be translated to Yii::app()->baseUrl . '/path/to/file.js'
.
With the new script/extension feature, you should rarely need to use this though.
from yii2.
Could I also reference and merge configs via the alias feature?
'components' => array(
'db' => '@config/mydb.php'
'urlManager' => array(
'rules' => array(
'@config/url-rules.php'
'<another:rule>' => '/my/controller'
)
)
)
from yii2.
I don't think so. This is just a shortcut, but has the drawback that it will complicate the configuration syntax.
from yii2.
Any other plans how to merge configs, still with CMap::mergeArray()
and/or require()
?
How will you (automatically) configure an extension?
from yii2.
To be more precise, my proposal above is inspired by the idea of having shorthands for CMap::mergeArray()
and require
in the config, just to generate a cleaner config file.
from yii2.
Related Issues (20)
- BaseActiveRecord save method behaviour HOT 1
- Setting YII_DEBUG=false in humhub 1.15.2 leads to internal server error HOT 2
- Memory usage leak when long operation HOT 6
- createControllerByID function add cache? HOT 14
- Relational queries populating invalid models when foreign key / linking value is 0 HOT 1
- request` failed for
- asDuration() produce wrong plural form when using russian locale HOT 2
- hasOne or hasMany return null when $link with two bigint element
- YII2 whether support reset-transaction? HOT 1
- PHP Deprecated: Calling session_set_save_handler() in `PHP 8.4`. HOT 4
- If the iframe is nested in another domain name, there is an exception in the Yii2 site at https://, where there is a jump from http:// HOT 3
- Invalid fatal error handling in php 8.3 HOT 11
- Does yii2 support connection pooling using redis? HOT 1
- Wrong `columnQuoteCharacter` default in Schema for sqlite3 HOT 2
- wulan HOT 1
- Logic failed in RegularExpressionValidator
- Validator error handling in php 8.3 HOT 2
- How should I use Yii2 version 2.0.42.1 in my project HOT 3
- RequiredValidator with typed properties HOT 7
- Unable to resolve the request "--" with chroot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2.