includes/template.php
changeset 419 b8b4e38825db
parent 413 6607cd646d6d
child 436 242353360e37
equal deleted inserted replaced
418:322fa0c91303 419:b8b4e38825db
    79     }
    79     }
    80     
    80     
    81     $this->style_list = $list;
    81     $this->style_list = $list;
    82     
    82     
    83   }
    83   }
    84   function sidebar_widget($t, $h)
    84   function sidebar_widget($t, $h, $use_normal_section = false)
    85   {
    85   {
    86     global $db, $session, $paths, $template, $plugins; // Common objects
    86     global $db, $session, $paths, $template, $plugins; // Common objects
    87     if(!defined('ENANO_TEMPLATE_LOADED'))
    87     if(!defined('ENANO_TEMPLATE_LOADED'))
    88     {
    88     {
    89       $this->load_theme($session->theme, $session->style);
    89       $this->load_theme($session->theme, $session->style);
    90     }
    90     }
    91     if(!$this->sidebar_widgets)
    91     if(!$this->sidebar_widgets)
    92       $this->sidebar_widgets = '';
    92       $this->sidebar_widgets = '';
    93     $tplvars = $this->extract_vars('elements.tpl');
    93     $tplvars = $this->extract_vars('elements.tpl');
    94     $parser = $this->makeParserText($tplvars['sidebar_section_raw']);
    94     
    95     $parser->assign_vars(Array('TITLE'=>$t,'CONTENT'=>$h));
    95     if ( $use_normal_section )
    96     $this->plugin_blocks[$t] = $h;
    96     {
       
    97       $parser = $this->makeParserText($tplvars['sidebar_section']);
       
    98     }
       
    99     else
       
   100     {
       
   101       $parser = $this->makeParserText($tplvars['sidebar_section_raw']);
       
   102     }
       
   103     
       
   104     $parser->assign_vars(Array('TITLE' => '{TITLE}','CONTENT' => $h));
       
   105     $this->plugin_blocks[$t] = $parser->run();
    97     $this->sidebar_widgets .= $parser->run();
   106     $this->sidebar_widgets .= $parser->run();
    98   }
   107   }
    99   function add_header($html)
   108   function add_header($html)
   100   {
   109   {
   101     $this->additional_headers .= "\n" . $html;
   110     $this->additional_headers .= "\n" . $html;
  1705           @eval($row['block_content']);
  1714           @eval($row['block_content']);
  1706           $c = ob_get_contents();
  1715           $c = ob_get_contents();
  1707           ob_end_clean();
  1716           ob_end_clean();
  1708           break;
  1717           break;
  1709         case BLOCK_PLUGIN:
  1718         case BLOCK_PLUGIN:
  1710           $parser = $this->makeParserText($vars['sidebar_section_raw']);
  1719           $parser = $this->makeParserText('{CONTENT}');
  1711           $c = (gettype($this->fetch_block($row['block_content'])) == 'string') ? $this->fetch_block($row['block_content']) : 'Can\'t find plugin block';
  1720           $c = (gettype($this->fetch_block($row['block_content'])) == 'string') ? $this->fetch_block($row['block_content']) : 'Can\'t find plugin block';
  1712           break;
  1721           break;
  1713       }
  1722       }
  1714       $parser->assign_vars(Array( 'TITLE'=>$this->tplWikiFormat($row['block_name']), 'CONTENT'=>$c ));
  1723       $parser->assign_vars(Array( 'TITLE'=>$this->tplWikiFormat($row['block_name']), 'CONTENT'=>$c ));
  1715       if    ($row['sidebar_id'] == SIDEBAR_LEFT ) $left  .= $parser->run();
  1724       $run = $parser->run();
  1716       elseif($row['sidebar_id'] == SIDEBAR_RIGHT) $right .= $parser->run();
  1725       if ( $row['block_type'] == BLOCK_PLUGIN )
       
  1726       {
       
  1727         $run = str_replace('{TITLE}', $this->tplWikiFormat($row['block_name']), $run);
       
  1728       }
       
  1729       if    ($row['sidebar_id'] == SIDEBAR_LEFT ) $left  .= $run;
       
  1730       elseif($row['sidebar_id'] == SIDEBAR_RIGHT) $right .= $run;
  1717       unset($parser);
  1731       unset($parser);
  1718     }
  1732     }
  1719     $db->free_result();
  1733     $db->free_result();
  1720     if(isset($vars['sidebar_bottom'])) 
  1734     if(isset($vars['sidebar_bottom'])) 
  1721     {
  1735     {