Opened 11 years ago

Closed 10 years ago

#458 closed new feature (fixed)

RoxAppView for output buffering

Reported by: lemon-head Owned by: lemon-head
Priority: major Milestone: Rox Framework
Component: FrameWork Keywords:
Cc:

Description

The class RoxAppView? can be used as a base class for application view objects. It provides a method

getAsString($methodname, $arg1, $arg2, ...)

that buffers the output of $this->$methodname() and returns it as a string.

This will help to keep our controllers tidy: Instead of

ob_start();
$view->teaser();
$Page->teaserBar .= ob_get_contents();
ob_end_clean();

we can now write

$Page->teaserBar .= $view->getAsString('teaser');

This is a cheap alternative, or preliminary replacement for the new RoxPageView architecture proposed in #436.

Change History (5)

comment:1 Changed 11 years ago by lemon-head

  • follow_up changed from none to review code
  • Owner set to lemon-head
  • Status changed from new to assigned

[4337] - RoxAppView? is online!

comment:2 Changed 11 years ago by lemon-head

This class is now called "PageWithParameterizedRoxLayout". Which describes exactly what it is :)

(the parameters being injected by "$page->title = ..." etc.

comment:3 Changed 11 years ago by lemon-head

sorry, I mixed somethign up. The above comment is about RoxGenericPage, which changed its name to PageWithParameterizedRoxLayout (the other still there as an alias). See #459.

comment:4 Changed 11 years ago by lemon-head

  • Milestone changed from unassigned to Rox Framework

comment:5 Changed 10 years ago by lemon-head

  • follow_up changed from review code to none
  • Resolution set to fixed
  • Status changed from assigned to closed

RoxAppView? is released.

Upon that, we have now another alternative called "ViewWrap?", looking like this

class ViewWrap
{
    private $_view_object;
    
    function __construct($view_object) {
        $this->_view_object = $view_object;
    }
    
    function __call($methodname, $args) {
        ob_start();
        call_user_func_array(array($this->_view_object, $methodname), $args);
        $str = ob_get_contents();
        ob_end_clean();
        return $str; 
    }
}

It automates the output buffering for us. I hope it is clear how it works..

Note: See TracTickets for help on using tickets.