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 470313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:52:21+00:00 2026-05-12T23:52:21+00:00

I have a Zend Framework application that is making use of jQuery UI. In

  • 0

I have a Zend Framework application that is making use of jQuery UI.

In my controllers, I am setting error/success messages with the FlashMessenger helper like this:

// ExampleController.php
$this->_helper->FlashMessenger('Sorry, could not complete your request.');

In my layout, I am displaying the messages by using the Noumenal FlashMessenger View Helper

// layout.phtml
<?php echo $this->flashMessenger(); ?>

I want to make use of my jQuery UI theme’s CSS styles to style my error messages like this:

<div class="ui-state-error ui-corner-all"> 
    <p><span class="ui-icon ui-icon-alert"></span> 
    <strong>Alert:</strong> Sample ui-state-error style.</p>
</div>

…but the View Helper is doing all the work, so I can’t change the classes how I want to. So before going down a dead end route, I thought I’d ask the community. Here are my questions:

  1. How can I use the Zend Framework FlashMessenger so that I can set different messages depending on the state (error/success)?
  2. How can I get the messages from the FlashMessenger and display them in a single place without having to create duplicate code in all of my controllers?
  3. How can I output a different class for each of the different message states? For example:
    'error'=>'ui-state-error', 'info'=>'ui-state-highlight', etc.
  • 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-12T23:52:22+00:00Added an answer on May 12, 2026 at 11:52 pm

    Having written the Noumenal FlashMessenger View Helper I should be able to help. 🙂

    To answer your question:

    Adding Messages

    You can set different message levels, e.g. error, warning etc, by passing an array to the FlashMessenger Action Helper rather than a simple string:

    // ExampleController.php
    $this->_helper->FlashMessenger(
         array('error'=>'Sorry, could not complete your request.')
    );
    

    The view helper is designed to recognise this.

    Outputting Messages

    When outputting FlashMessages in your layout, there are optional parameters that you can pass to specify the default message level (which is warning by default) and a template for your message.

    Adapting your code snippet to account for differing message levels you could achieve the desired result by making the following call in your layout:

    // layout.phtml
    $template = '<div class="ui-state-error ui-corner-all"> 
        <p class="%s"><span class="ui-icon ui-icon-alert"></span> 
        <span class="flash-message">%s</span></p>
    </div>';
    echo $this->flashMessenger('error', $template);
    

    (You may find it better to set the template as a view variable in, say, your bootstrap.)

    Doing this the view helper will construct the appropriately formatted flash messages for you as you wish.

    Some Simple Styling

    Using CSS there would be plenty of room to style the messages appropriately. For example:

    .alert {
        color: red;
    }
    
    .alert .flash-message:before {
        content: "<strong>Alert</strong> ";
    }
    
    .notice {
       color:yellow;
    }
    
    .notice .flash-message:before {
        content: "<strong>Notice</strong> ";
    }    
    

    I leave you to improvise…

    I wrote a guide to Zend Framework FlashMessenger and the view helper on my blog. Perhaps give that a read. Also please do email me to let me know your difficulties — it will help me know what I need to improve.

    I hope that helps.

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

Sidebar

Ask A Question

Stats

  • Questions 274k
  • Answers 274k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First, this assignment is not legal: Coffee coffee = new… May 13, 2026 at 2:22 pm
  • Editorial Team
    Editorial Team added an answer The problem was that I should have been using buttons.frame… May 13, 2026 at 2:22 pm
  • Editorial Team
    Editorial Team added an answer you need to add proxy_set_header Authorization "Basic ...."; where the… May 13, 2026 at 2:22 pm

Related Questions

Part 1 I want to build a PHP Zend Framework application that users can
I have a quick question about how to serve data from a repository in
I'm developing a zend framework application that includes a simple email function. The development
For the past time I have been working on a Zend Framework based webshop

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.