class html { private $_templateSrc; private $_contents; public function __construct($templateSrc, $contents) { $this->_templateSrc = $templateSrc; $this->_contents = $contents; } public function insertCSS($src, $type=null) { } public function insertJS($src) { } public function show() { Core::loadFile($this->_templateSrc); } }
I w szablonie jest coś takiego
<?php $this->insertCSS(Core::DEFAULT_VIEWS_SRC . $this->_view . '/' . 'uklad.css'); ?>
Ale niestety to wywala błąd:
Cytat
Fatal error: Using $this when not in object context in [ścieżka]\views\html\templates\default\default.html on line 6
Czy da się to jakoś załatwić, żeby informacje były wyciągane bezpośrednio z widoku? Czyli innymi słowy, żeby nie było tego błędu i wszystko działało :-) ?