Вот мой первый класс, постигаю азы ООП, надеюсь я не безнадежен))
class ResourcesConnector
{
private $abs_css_path;
private $abs_js_path;
private $abs_img_path;
private $css_path;
function setAbsPaths($abs_css_path, $abs_js_path, $abs_img_path)
{
$this->abs_css_path = $abs_css_path;
$this->abs_js_path = $abs_js_path;
$this->abs_img_path = $abs_img_path;
}
function setPaths($css_path)
{
$this->css_path = $css_path;
}
function CSS()
{
$open_css_folder = opendir($this->abs_css_path);
while ($filename = readdir($open_css_folder)) {
if ($filename != '.' and $filename != '..') {
echo '<link rel="stylesheet" type="text/css" href="' . $this->css_path, $filename .'" />';
}
}
}
function HEAD_OPEN($title)
{
echo '<!DOCTYPE html>';
echo '<html><head>';
echo '<title>'. $title .'</title>';
}
function HEAD_CLOSE()
{
echo '</head>';
}
function BODY_OPEN()
{
echo '<body>';
}
function BODY_CLOSE()
{
echo '</body></html>';
}
function monsterStart($smartyObj, $pageTitle, $tplNmae)
{
$this->HEAD_OPEN($pageTitle);
$this->CSS();
$this->HEAD_CLOSE();
$this->BODY_OPEN();
$smartyObj->display($tplNmae);
$this->BODY_CLOSE();
}
}