Kammy
Kammy

Reputation: 431

handling messages or text at one place in zend framework

I want to place all messages module-wise at one place. so that if any changes occurred i will go to particular module message file and change the message.

There is one method I am thinking of is create php file which will have array indexes with messages as value. $module1Messages = array(); $module1Messages['session_timeout'] = "Session has been timed out"; And that file can be loaded as per modules and requirement.

What could be best method to achieve this in zend framework, so that it will not put overhead in memory and faster to execute.

Upvotes: 0

Views: 90

Answers (1)

Bob Baddeley
Bob Baddeley

Reputation: 2262

Look at the zend_translate (http://framework.zend.com/manual/en/zend.translate.html). Not only will it let you have a file of messages, but you can have a variety of file formats (adapters) that can be read, and you can use zend_lang to have your translation files be international, automatically picking the file set for your language. If the message you refer to isn't defined in the file, you can set it to display a default text, too. AND, you can have a log file so that if you come across a message that isn't defined in a file, it'll log it so that you can check the logs and go back and define those messages.

Upvotes: 4

Related Questions