Understanding Noah's Classifieds/Let's Discover gorumMain

function gorumMain(&$s)
{
    global $gorumroll,$lll,$whatHappened,$infoText,$gorumcontent;
    global $initClassName,$navBarText;
    global $upperTemplate,$lowerTemplate;    
    global $globHtmlHead, $HTTP_GET_VARS;

This includes all the global variables required. Global variables like these don't have to be defined you can just include them and use them. The same way you don't have to define scope variables.

    $s="";
    $init = new $initClassName;
    $init->initializeSystemSettings();    
    $base = new $gorumroll->class;
    $olc=$gorumroll->list."_".$gorumroll->method."_lllcancel";
    if (isset($lll[$olc])) {$lll["cancel"]=$lll[$olc];}

It seems the next step the main program makes a bolean decision. It determines whether the previous create/update/edit/delete had the user click cancel. It then brances into two

    if( $gorumroll->submit==$lll["cancel"] )
    {
        $whatHappened="form_submitted";
        $infoText = $lll["operation_cancelled"];
        // html template file meghatarozasa a teljes oldal layoutjahoz
        // (ELD stilusu template-ezes, ha van ilyen) kitalalja, hogy mi 
        // lesz a template file, amit a showApp hasznal:
        $init->getTemplate();
        goBackward($base);

The wonderful thing of Noah is its prebuilt backward navigation as seen here. If you cancel it sends you back to where you came from.

        $init->getTemplateAfter();
        processMethod($base, $processResult);
    }
    else
    {
        $whatHappened="";
        processMethod($base, $processResult);
        // html template file meghatarozasa a teljes oldal layoutjahoz
        // (ELD stilusu template-ezes, ha van ilyen) kitalalja, hogy mi 
        // lesz a template file, amit a showApp hasznal:
        $init->getTemplate();
        if( $whatHappened ) // Ez jelzi, hogy meg egy processMethod kell
        {
            goBackward($base);
            $init->getTemplateAfter();
            processMethod($base, $processResult);
        }
    }

Now the next thing has to do with the Head,Top and Footer templates

    if (ereg("\.php$",$upperTemplate)) {//just check
        $ret=@fopen($upperTemplate,"r");
        if (!$ret) {
            $infoText = sprintf($lll["incl_header_err"],$upperTemplate);
        }
        @fclose($f);
    }
    if (ereg("\.php$",$lowerTemplate)) {//just check
        $ret=@fopen($lowerTemplate,"r");
        if (!$ret) {
            if (!isset($infoText)) $infoText="";
            $infoText.="
".sprintf($lll["incl_footer_err"],$lowerTemplate); } @fclose($f); }

Here comes the actual interesting rendering stuff. showNavBar draws those text like submit add etc.

    //show functions
    $gorumcontent="";
    $navBarText=$base->showNavBar();//TODO: a navbar altalanos cucc?
    $gorumcontent.= $processResult;
    
    $globHtmlHead=$init->showHtmlHead();

This links the header file^^

    if( isset($HTTP_GET_VARS["inf"]) ) $infoText=$HTTP_GET_VARS["inf"];
    $sApp=$init->showApp();

Here is the point at which the actual working of noah gets executed, it will run down the hierachy and execute the right class. Rendering your detail/listing or whatever

    $s.=$globHtmlHead;//fontos, hogy felulirhato legyen az app-ban

Now it gets the upper and lower template

    $upperTemplate=trim($upperTemplate);
    if (ereg("\.php$",$upperTemplate)) 
	{
        $ret=@include($upperTemplate);
    }
    else $s.="$upperTemplate\n";
    $lowerTemplate=trim($lowerTemplate);

Finally it adds the output from your application to the final text.

    $s.=$sApp;
    if (ereg("\.php$",$lowerTemplate)) $ret=@include($lowerTemplate);
    else $s.="$lowerTemplate\n";

}

processMethod($base, $processResult); is very peculiar as it seems it has to do with the processing of data. In Noah they have abstracted the data away from the view (a very good thing)