2010年8月19日星期四

[fw-mvc] How to use placeholder based helpers on multiple outputs

Hi,

A normal application may have multiple ways to interact with user. There is the application/website itself, the emails sent by app to users, RSS feeds, aso.

I noticed one problem when working with placeholder helpers (headtitle, headlink, aso) on multiple such outputs at the same time.

Let's take a simple case: let's suppose we have the contact action. This action does 2 things:

1. It renders a form

2.
Sends an email once the form is submitted

Both the action generated page and the email have a layout behind.

The problem is the styles, titles, scripts are actually merged for both of layouts: the one for email and the one for website.

I think the solution is to set different containers for the helpers on email layout and website layout, at each call. Something like this:

$container = new Zend_View_Helper_Placeholder_Container();
$this->headTitle($itle)->setContainer( $container );

This is supposed to fully solve the problems ?

Cristian

没有评论: