<?php
    //------------------------------------------------------------------------------
    // render.php
    //
    // the blur6ex rendering pipeline
    //
    //
    //------------------------------------------------------------------------------
    function render($shard, $action)
    {
        global $siteSettings;
        global $CURRENTUSER;
         
         
        if (strpos($action, "g_") !== FALSE)
        {
            // setting up graft
           
            $graft = 'engine/grafts/' . $siteSettings['graft'] . '/graft.php';
            include($graft);
            
             
            // setting up page
            drawHeader();
             
            $order = get_render_order();
            if ($order == 1 )
            {
                //
                //processing main shard
                //
                include('engine/shards/' . $shard . '.php');
            }
             
             
             
            //
            // processing left side menu
            //
            $menuArray = $siteSettings['lMenu'];
            $menuArray = explode(":", $menuArray);
             
            start_left();
            for ($i = 0; $i < sizeof($menuArray); $i++)
            {
                if ($menuArray[$i] != "")
                {
                    include('engine/shards/' . $menuArray[$i] . '.php');
                }
            }
            end_left();
             
            //
            // Process the right side menu
            //
            $menuArray = $siteSettings['rMenu'];
            $menuArray = explode(":", $menuArray);
             
            start_right();
            for ($i = 0; $i < sizeof($menuArray); $i++)
            {
                if ($menuArray[$i] != "")
                {
                    include('engine/shards/' . $menuArray[$i] . '.php');
                }
            }
            end_right();
             
             
            if ($order == 0 )
            {
                //
                //processing main shard
                //
                include('engine/shards/' . $shard . '.php');
            }
             
             
             
            // Closing page
            drawFooter();
        }
        else
        {
            include('engine/shards/' . $shard . '.php');
             
        }
         
         
         
    }
     
     
?>
