My Yii application consists of 4 modules. Each module has its own config file main.php listing configuration for only url manager.I have all other configurations inside /config/main.php of application directory. Is there a solution to mere each of the modules configuration into main configuration file ?
I am not sure if your using Yii 1 or 2. Your question says Yii but is tagged as yii2.
If its Yii 1, then try this -
You have 4 modules. They must be located at
/protected/modules/MODULE_NAME1, /protected/modules/MODULE_NAME2, and the other two.
Each module having its own main.php consists of array for UrlManager.
Lets say you have a config folder in each MODULE_NAME folder and main.php in it.
So the location becomes - /protected/modules/MODULE_NAME1/config/main.php.
Now, in the index.php, you must be having a line of code as $config=dirname(__FILE__).'/protected/config/main.php';
This is how the main.php(located at /protected/config/main.php) data is fetched.
So if you want to add more config arrays, then just fetch each of them and merge with the primary one.
Eg:
$config = array_merge(
require(dirname(__FILE__).'/protected/config/main.php'),
require(dirname(__FILE__).'/protected/modules/MODULE_NAME1/config/main.php'),
require(dirname(__FILE__).'/protected/modules/MODULE_NAME2/config/main.php'),
require(dirname(__FILE__).'/protected/modules/MODULE_NAME3/config/main.php'),
require(dirname(__FILE__).'/protected/modules/MODULE_NAME4/config/main.php'),
);
Make sure the arrays returned from the Module's main.php have the same structure for urlManager.
Related
I created a jmeter project with the included controller, which calls another jmx.
I need to dynamically construct the path using a csv in which there are the names of the jmx children to be called. For example C: performance $ {JmxName}.
I tried using the CSV Data Set Config but the included controller does not recognize the variable (Error displayed: File "C:\performance\${JmxName}" not found for Include Controller "Include Controller")
do you have ideas on how to reach the goal?
thank you in advance
According to the documentation:
This element does not support variables/functions in the filename field
So you will not be able to achieve this using Include Controller.
The options are in:
Include your "children" JMX scripts into the main JMX script and refer them via Module Controller where required. If you need to choose this or that scenario basing on the value of the variable from the CSV file - put the Module Controller's under the Switch Controller
If you cannot include children JMX scripts into the main one you can kick off them as separate processes using i.e. OS Process Sampler. The test results can be combined after the execution using i.e. Merge Results tool
I have a controller that uses same constant variables in its different functions, the variables are too many about 100. I need to keep them in a separate file and call/include the file in my controller to access them. How do i go about that and where is the best place to keep the file in my cake app/
I would place a php file in your config folder where you set all the variables:
use Cake\Core\Configure;
Configure::write('variableName','value');
and anywhere where you need these you can:
use Cake\Core\Configure;
$variable = Configure::read('variableName');
What is the best way to store read-only configuration in symfony?
I have some name/description pairs inside a JSON file, currently sitting in a bundle's resource directory that I'd like to use inside my controllers and views but don't want to insert into my database.
And what do you recommend for parsing / getting the values to display? Making a specific service for the DiC doesn't feel to good tbh..
Same scenario with me ,I worked with ymls file , create a yml file in config folder like product.yml , parse it in controller then send its josn to template .
And this is the right way to play with static data .
I have too many modules (around 90) in my project.
But I want to keep individual displaytag.properties file for each module rather than having single file for whole project.
How to achieve this.
I am using struts2
I think that you can configure each displaytag using the appropiate bundle, remember the bundle search order from S2 docs:
ActionClass.properties Interface.properties
Interface.properties (every interface and sub-interface)
BaseClass.properties (all the way to Object.properties)
ModelDriven's model (if implements ModelDriven), for the model object repeat from 1
package.properties (of the directory where class is located and every parent directory all the way to the root directory)
search up the i18n message key hierarchy itself
global resource properties
and from the docs for the DisplayTag library:
For the whole web application, create a custom properties file named "displaytag.properties" and place it in the application classpath. Displaytag will use the locale of the request object to determine the locale of the property file to use; if the key required does not exist in the specified file, the key will be loaded from a more general property file.
so i guess that the displaytag will search the config keys in the s2 available bundles.
I want to load different config files for different conditions. for example, if I have "vendor" in my variable value, then load a vendor's config file, similarly for ext_warehouse.
not possible, SSIS will load all the file you specify on the package configuration organizer on the order they are listed and it will use the values on the configuration files to load your variables.
What you could do, lets say you have a "vendors.dtsConfig" and a"customer.dtsConfig", is to create a parent package that read a config file called "parent.dtsConfig" that will only have your variable containing "vendor" or "customer" and based on that value you copy the correct config file to another folder and call the actual package that reads the recently copied (and renamed) file