MyBB Community Forums

Full Version: Inconsistent ACP methods (page, form, table)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
1.6 uses inconsistent methods for outputting page, form and table objects to the browser or to a variable.

example:

Table object uses $table->end($return=false) to output all the table content to a variable with $return = true or echo's it with the default case.

But the Form object requires a parameter setting during the construct method, and its the 6th parameter no less, which is the third optional parameter. To use this output you need to call $form->construct_return and then append all the other output (mentioned below)

Then the other Form output functions need another parameter passed to return a variable, again with several optional parameters before it. Finally the Form->end function needs a TRUE parameter passed to make it return and not echo.

Also, the form_container object works like the table object and takes a TRUE parameter in $form_container->end() to make it return instead of echo.

I know I could use object buffering, but that is a lot more overhead.

It would be nice if these routines were made consistent and maybe if the constructor of all of them would take a $return parameter sooner in the list just use that class/object variable instead of taking parameters all over the place.

function _construct($param1, $param2, $param3, $return=false, $param4='')
if $return then $this->_return = true;

function output_row()
if $this->_return then return $output;
else echo $output;

function end()
if $this->_return then return $output;
else echo $output;
I think you forgot your example?
somehow enter sent the form, weird. I have made my edit