Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5990747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:17:18+00:00 2026-05-22T23:17:18+00:00

I am working on PHP and Zend. I have to show different type of

  • 0

I am working on PHP and Zend. I have to show different type of error/confirmation messages in application. Most of these messages are placed in code. So if I have to change one message then I have to change it everywhere where this particular type of message is coded.

So what is the best way to store all messages in on place and use them across the application.

Possible solutions:

  • Store all messages in database. (We have to move these messages to other database type. For example if we move from MySQL to SQL Server.)

  • Store all messages in separate php class using array and get these messages using class methods (Problem: We can not use this class in other programming languages.)

  • Store message in special format which acceptable for all languages for example ini type of files.

EDIT: (After looking Ozair’s Answer)

Sometimes we have to change message for particular record. For example:

Product No. 10 is deleted.
Product No. 15 is deleted.

What will be best method to handle this case ?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:17:19+00:00Added an answer on May 22, 2026 at 11:17 pm

    You could have some sort of static class in the library folder. Which would contain a set of constant variables like

    PRODUCT_SAVED_OK = "The product {{id}} was saved successfully";
    

    The I would have two static methods which take care of displaying the error/message

    public static function showMessage($message , $data = array("id" => "10"){
        foreach($data as $key => $value){
            $message = str_replace("{{" . $key . "}}", $value , $message);
        }
        echo $message;
    }
    
    public static function showError($error){
       echo $error;
    }
    

    Than in your code whenever you need to display the message you simply invoke the static class like so…

    Messages::showMessage(Messages::PRODUCT_SAVED_OK);
    

    That way all the messages the application needs will be contained in one class and if need be that the message changes you only have to change it this class.

    What do you think?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Zend Framework application with PHP. I have a form
I have been working on a new installation of a Zend Framework application for
I'm actually working on a web application coded in php with zend framework. I
I am working with Capistrano to automate deployment of a PHP Zend framework application.
I am working on zend framework, PHP and jQuery. I am working on popups
I am working with php and want to have a page that has a
at my working place (php only) we have a base class for database abstraction.
I am a web-developer working in PHP. I have some limited experience with using
i have used zend paginator in my app its working fine the way its
I am currently working on a big management system (in PHP using Zend Framework,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.