I installed the yii-web-start extension, it uses a database for message translation, but I need use gettext instead.
Where and how can I configure YII-i18n?
You can set up i18n in your config (protected/config/main.php) with CGettextMessageSource to use gettext.
'components' => array(
'messages' => array(
'class' => 'CGettextMessageSource'
)
),
By default, you should store your .po-files under protected/messages.
Related
Laravel comes with some basic config files available in config directory.
which each file is basically an associated array.
now, I want to change the structure of config/mail.php from
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello#example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
to
'from' => [
'noreply' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello#example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
]
],
so I can have several emails with differnt name.
My question is generic here.
What are(if any) disadvantages of modifying structure of the config files?
Is it possible to be troublesome between LTS upgrades?
You shouldn't modify email.form data because Laravel uses the data:
You may specify a global from address in your config/mail.php configuration file. This address will be used if no other from address is specified within the mailable class
I'm new to the Yii Framework. I was given an application to work on at the office. How can I change the base url of an application in Yii1?
You can edit /path/to/application/protected/config/main.php to change the default value. Add a request component, and configure baseUrl porperty.
return array(
...
'components' => array(
...
'request' => array(
'baseUrl' => 'http://www.example.com',
),
),
);
I download 1.1.14,and try it , get a question about user authTimeout
Any one can help me?
When i used the configration
like this:
'comments'=array(
`user`=array(
...
'absoluteAuthTimeout' => 60*100,
...
and logined, but ,click user pannel at once , it logout auto.
Regards
You can implement Session Timeout in the config file like
'components' => array(
'session' => array(
'timeout' => 300,
),
),
Does somebody know how to cache doctrine2 entities in a zf2 project. I cant find a tutorial or website where this is explained. I cant find any information to start with defining a entity filecache.
Somebody of you got working links or examples.
Thanks
You have two options
Use doctrine's native caching, e.g. using memcache (in the memcache block you can use any kind of doctrine supported cache, a full list of cache drivers is available).
Use doctrine's adapter for Zend/Cache/Storage to use another cache that you're using elsewhere; the adapter is described in the DoctrineModule docs.
As an example of version two, I have something like the following configuration in a module (actually spread across various config files, so I can't guarantee that copy-pasting verbatim will work).
'services' => array(
'factories' => array(
// Wraps a ZF2 cache storage in a Doctrine compatible way
'doctrine.cache.zend.static.local' => function ($services) {
return new ZendStorageCache($services->get('cache.static.local'));
},
),
'caches' => array(
// A ZF2 cache, can be configured as you like
'cache.static.local' => array(
'adapter' => 'xcache',
'plugins' => array(
'exception_handler' => array(
'throw_exceptions' => false,
),
'serializer',
),
),
),
'doctrine' => array(
'configuration' => array(
'orm_default' => array(
'metadata_cache' => 'zend.static.local',
'query_cache' => 'zend.static.local',
),
),
),
Note that Doctrine annoyingly automatically prefixes "doctrine.cache." to the name of the cache service that you configure, so while we configure "metadata_cache" to "zend.static.local", the actual cache service must be named "doctrine.cache.zend.static.local". Obviously you can call them what you want, but you'll need to add that prefix to whatever you call them.
To activate file cache you just need to add in your module.config.php
'doctrine' => array(
'configuration' => array(
'orm_default' => array(
'metadata_cache' => 'filesystem',
'query_cache' => 'filesystem',
)
),
)
and it will create cache automatically in data/DoctrineModule/cache folder
here is my full doctrine config for ZF 2.2.4 + Doctrine 2
'doctrine' => array(
'driver' => array(
'application_entities' => array(
'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/Modulename/Entity')
),
'orm_default' => array(
'drivers' => array(
'Modulename\Entity' => 'application_entities'
),
)
),
'configuration' => array(
'orm_default' => array(
'metadata_cache' => 'filesystem',
'query_cache' => 'filesystem',
)
),
),
i am trying to create a product (with basic attributes) when the custom module get installed.
i am developing a magento custom module which requires a product to be created at the time of its installation. i have successfully created a product in programmatic way (on fly) but it requires to be created only when the specific parameter received and also after successful transaction it needs to be deleted so i was asked ,in order to save the hassle why not create the product when the module get installed via installer script (in setup directory).
but i am not able to find the way yet as i am new to the magento module development.
any suggestions , is it a right approach? if so what should be the process? is there a specific even that can be triggered when the module get installed?
thanking you all in anticipation
Try in this way:
$data = array(
'name' => '<name>',
'sku' => '<sku>',
'attribute_set_id' => <attribute_set_id>,
'type_id' => <product_type_code>,
'website_ids' => array(1),
'description' => '<description>',
'short_description' => '<short_description>',
'price' => <price>,
'tax_class_id' => <tax_class_id>,
'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED,
'category_ids' => array(<category_ids>),
);
$productModel = Mage::getModel('catalog/product');
$productModel->setData($data)
->save();