|
Last change
on this file was 3, checked in by george, 17 years ago |
|
Přidáno: Nastavení počtu zobrazených serverů na stránku a počtu nej serverů v konfiguračním souboru.
Opraveno: Pročištění použití stylů a vyřešení překrývání hlavního seznamu s pravým sloupcem u některých prohlížečů. Všechny informace o stylech musí být v souboru CSS a ne v HTML kódu.
|
|
File size:
1.6 KB
|
| Line | |
|---|
| 1 | <?php
|
|---|
| 2 | class Html_template
|
|---|
| 3 | {
|
|---|
| 4 | public $output=array();
|
|---|
| 5 | public $start_separator = '{';
|
|---|
| 6 | public $end_separator = '}';
|
|---|
| 7 | public $template;
|
|---|
| 8 | public $global_template;
|
|---|
| 9 | public $menu_template;
|
|---|
| 10 | public $start_global = '[';
|
|---|
| 11 | public $end_global = ']';
|
|---|
| 12 | public $compression = 'ob_gzhandler';
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 | function __construct()
|
|---|
| 16 | {
|
|---|
| 17 | ob_start($this->compression);
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | function flush()
|
|---|
| 21 | {
|
|---|
| 22 | $handler = fopen($this->template, 'r');
|
|---|
| 23 | $template_text = fread($handler, filesize($this->template));
|
|---|
| 24 | fclose($handler);
|
|---|
| 25 | if ($this->global_template != '')
|
|---|
| 26 | {
|
|---|
| 27 | $global_handler = fopen($this->global_template, 'r');
|
|---|
| 28 | $global_text = fread($global_handler, filesize($this->global_template));
|
|---|
| 29 | fclose($global_handler);
|
|---|
| 30 | if ($this->menu_template != '')
|
|---|
| 31 | {
|
|---|
| 32 | $menu_handler = fopen($this->menu_template, 'r');
|
|---|
| 33 | $menu_text = fread($menu_handler, filesize($this->menu_template));
|
|---|
| 34 | fclose($menu_handler);
|
|---|
| 35 | $global_text = eregi_replace('\\'.$this->start_global.'local'.'\\'.$this->end_global, $menu_text, $global_text);
|
|---|
| 36 | }
|
|---|
| 37 | $html_template = eregi_replace('\\'.$this->start_global.'local'.'\\'.$this->end_global, $template_text, $global_text);
|
|---|
| 38 |
|
|---|
| 39 | }
|
|---|
| 40 | else
|
|---|
| 41 | {
|
|---|
| 42 | $html_template = $template_text;
|
|---|
| 43 | }
|
|---|
| 44 | foreach ($this->output as $key => $value)
|
|---|
| 45 | {
|
|---|
| 46 | $html_template = eregi_replace ($this->start_separator.$key.$this->end_separator, $value, $html_template);
|
|---|
| 47 | }
|
|---|
| 48 | echo $html_template;
|
|---|
| 49 | ob_flush();
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|
| 52 | ?>
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.