Здравствуйте. template является методом класса. Когда я использую его на странице, функции выполняются дважды. Как это исправить? PHP: function template($part) { require_once($this->STYLESdir.$this->style.'/'.'headerandfooter.php'); if ($part='header') {pageheader();} if ($part='footer') {pagefooter();} }
Вот, только это не всё, остальное здесь не используется PHP: <?php class Xcat { public $XMLdir='../x-files/'; public $STYLESdir='../styles/'; public $XMLfile; public $root; public $xml; /* Это хрантся в файле конфигурации */ public $keywords; public $description; public $youremail; public $style; /* читает файл конфигурации */ function readconf (){ $config = DOMDocument::load($this->XMLdir.'config.xml'); $mainconf = $config->getElementsByTagName('config')->item(0); $this->youremail=$mainconf->getAttribute('youremail'); $this->style=$mainconf->getAttribute('style'); } /* skinning engine :D */ function template($part) { require_once($this->STYLESdir.$this->style.'/'.'headerandfooter.php'); if ($part='header') {pageheader();} if ($part='footer') {pagefooter();} } } } ?> Вот я использую его на странице PHP: <?php require_once ('x-cat/Xcat.php'); $Xcat=new Xcat; $Xcat->XMLdir='./x-files/'; $Xcat->STYLESdir='./styles/'; $Xcat->readconf(); $Xcat->template('header'); $Xcat->template('footer'); ?>