Giter VIP home page Giter VIP logo

Comments (7)

qiangxue avatar qiangxue commented on May 29, 2024

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.

schmunk42 avatar schmunk42 commented on May 29, 2024

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.

qiangxue avatar qiangxue commented on May 29, 2024

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.

schmunk42 avatar schmunk42 commented on May 29, 2024

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.

qiangxue avatar qiangxue commented on May 29, 2024

I don't think so. This is just a shortcut, but has the drawback that it will complicate the configuration syntax.

from yii2.

schmunk42 avatar schmunk42 commented on May 29, 2024

Any other plans how to merge configs, still with CMap::mergeArray() and/or require()?
How will you (automatically) configure an extension?

from yii2.

schmunk42 avatar schmunk42 commented on May 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.