예제 #1
0
파일: CCTheme.php 프로젝트: clancats/core
 /**
  * theme creator
  * returns a new view instance
  *
  * @param string		$file
  * @param array 		$data
  * @param bool		$encode
  * @return CCView
  */
 public static function create($file = null, $data = null, $encode = false)
 {
     $view = parent::create(static::view_namespace() . '::' . $file, $data, $encode);
     // set the asset holder path
     \CCAsset::holder('theme')->path = static::public_namespace();
     // set the vendor path
     \CCAsset::holder('vendor')->path = 'assets/vendor/';
     // you may ask why not just return the parent::create(bla bla.. directly?
     // i actually wanted to do something with that var view. So if you'r still
     // able to read this i completly forgot it.
     return $view;
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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);
 }
예제 #4
0
    echo $sidebar;
    ?>
			</div>
			<div class="col-md-9">
				<?php 
    echo $content;
    ?>
			</div>
		</div>
		<?php 
} else {
    ?>
		<?php 
    echo $content;
    ?>
		<?php 
}
?>
	</div>
</div>

<!-- footer scripts -->
<?php 
echo CCAsset::code('js', 'vendor');
echo CCAsset::code('js', 'theme');
echo CCAsset::code('js');
echo $js;
?>
</body>

</html>
예제 #5
0
파일: CCAsset.php 프로젝트: clancats/core
 /**
  * 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'));
 }