Hi everybody
I really like the View Helper concept but I want to create some kind of a
widget architecture.
I've created some test classes as a proof of concept.
I have inherited from the Abstract View Helper class to create some Widget
Classes. So far so good.
But then I got some problems, such as for example if I wanted to nest
widgets.

After this I looked for other solutions

My new idea is to create a widget element like this pseudo code below

<w:my_widget>
        <w:label value="{title}">
        <w:my_other_widget>www.test.com<w:my_other_widget>
</w:my_widget>

To get this to work i have to parse the content and create the widgets and
add them together.
Here is some pseudo code of the Parser

$my_other_widget = new my_other_widget();
$my_other_widget->setContent($content); -> content is "www.test.com" 

$my_widget = new my_widget();
$my_widget->addChild($my_other_widget,$key); 
$my_widget->setContent($content); 

This code has no sense, it is only an idea.

Now to my question
what is the best possibility to parse the output

I have found 3 options so far, another important argument is that I need to
have access to view variables

1. To program a similar "Widget" ViewHelper as the "PlaceHolder" ViewHelper

<?php $this->widget(array('title' => $my_title))->captureStart(); ?>
<w:my_widget>
        <w:label value="{title}">
        <w:my_other_widget>www.test.com<w:my_other_widget>
</w:my_widget>
<?php $this->widget()->captureEnd(); ?>

And parse the output and translate directly into HTML and echo it at the
captureEnd() method, but this method is a little ugly

2. Inherit from the PhpRenderer and parsing the output in the render ()
method
    qustion:
Do I need to develop my own resolver and rendering Startegy when i inherit
from Phprenderer or is it an easy task to do?


3. Injecting a filter chain object into the Phprenderer with setFilterChain
() method
    I like to test this approach but i havent found a solution to get the
phprender instance.
    Question:
How can i inject an output filter into the Phprenderer instance ?  do i need
to use a factoriy in the service_manager?

What is the best approach to go for ?
Are there any better/faster ways to parse the output ?

I would love to here some suggestions

Best regards 
Michael Haessig

--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-beta5-widget-architecture-with-view-helpers-tp4655790.html
Sent from the Zend Framework mailing list archive at Nabble.com.

--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to