/** * custom theme render stuff * * @param string $file * @return string */ public function render($file = null) { foreach (static::$config->default as $key => $value) { $this->set($key, $value); } // assign the topic to the title if ($this->has('topic') && $this->has('title')) { $this->title = sprintf($this->get('title'), $this->get('topic')); } // add default assets \CCAsset::add('js/jquery/jquery.js'); \CCAsset::add('js/bootstrap.min.js', 'theme'); \CCAsset::add('css/bootstrap.min.css', 'theme'); \CCAsset::add('css/style.css', 'theme'); return parent::render($file); }
/** * custom theme render stuff * * @param string $file * @return string */ public function render($file = null) { foreach (static::$config->default as $key => $value) { if (!$this->has($key)) { $this->set($key, $value); } } // assign the topic to the title if ($this->has('topic') && $this->has('title')) { $this->title = sprintf($this->get('title'), $this->get('topic')); } // add assets from config foreach (static::$config->assets as $asset => $container) { $container = explode("@", $container); if (isset($container[1])) { \CCAsset::pack($asset, $container[0], $container[1]); } else { \CCAsset::add($asset, $container[0]); } } return parent::render($file); }
/** * CCAsset::code tests */ public function test_code_gen() { CCAsset::macro('test', '<:uri>'); CCAsset::holder('root')->path = '/'; CCAsset::add('foo.test', 'root'); CCAsset::add('bar.test', 'root'); $this->assertEquals('</foo.test></bar.test>', CCAsset::code('test', 'root')); }