0

I was just wondering why no code-behind or helpers were made to work with layouts? I have stuff I want to display in my layouts without having to set it up in a placeholder for every single controller.

I was also wanted to know what is the best way to persist a display-once "success-message" across many pages. For example, a user fills out a form and when it is submitted correctly they are redirected to another page. I want the user to see a success message on that other page. Is there some sort of provision in Zend Framework that makes this easier?

Walt
  • 1,521
  • 2
  • 13
  • 29

1 Answers1

2

Well for the messages you can use the Flash Messenger helper

As far as setting up the place holders you could use a base controller and set these up in the init method overriding on descendents when necessary.

prodigitalson
  • 60,050
  • 10
  • 100
  • 114
  • 1
    +1. Other alternatives to base controller include: action helper and front-controller plugin. – David Weinraub Jan 17 '12 at 03:46
  • Ah, so just do a "zf create controller BaseController" and then have everything extend that controller? Or is there another way of doing that that I am missing? – Walt Jan 21 '12 at 22:22
  • Well as David suggested you could use a action helper or FrontController plugin, which honestly is a better way to go if the project is pretty large. But if you want to jsut "get it done" using a base controller class is probably the easiest way. I wouldnt create it with Zend_Tool though because it really belongs in your `Library` not in your `Application`. – prodigitalson Jan 21 '12 at 23:41