Pubwich::getLoop PHP Method

getLoop() public static method

Displays the generated HTML code
public static getLoop ( ) : string
return string
    public static function getLoop()
    {
        $columnTemplate = function_exists('columnTemplate') ? call_user_func('columnTemplate') : '<div class="col{{{number}}}">{{{content}}}</div>';
        $layoutTemplateDefined = false;
        if (function_exists('layoutTemplate')) {
            $layoutTemplate = call_user_func('layoutTemplate');
            $layoutTemplateDefined = true;
        } else {
            $layoutTemplate = '';
        }
        $output_columns = array();
        $m = new Mustache();
        foreach (self::$columns as $col => $classes) {
            $boxes = '';
            foreach ($classes as $class) {
                $boxes .= $class->renderBox();
            }
            $output_columns['col' . $col] = $m->render($columnTemplate, array('number' => $col, 'content' => $boxes));
            if (!$layoutTemplateDefined) {
                $layoutTemplate .= '{{{col' . $col . '}}} ';
            }
        }
        return $m->render($layoutTemplate, $output_columns);
    }

Usage Example

Example #1
0
/style.css" type="text/css">
<?php 
echo Pubwich::getHeader();
?>
	</head>
	<body>
		<div id="wrap">
			<h1><a href="/" rel="me"><?php 
echo PUBWICH_TITLE;
?>
</a></h1>
			<hr>
			<div class="clearfix">

<?php 
echo Pubwich::getLoop();
?>

			</div>
			<div id="footer">
				<div class="footer-inner">
					<hr>
					<?php 
echo sprintf(Pubwich::_('All data is &copy; copyright %s. Proudly powered by %s.'), date('Y'), '<a class="pubwich" href="http://pubwich.org/">Pubwich</a>');
?>
				</div>
			</div>
		</div>
<?php 
echo Pubwich::getFooter();
?>