本文整理汇总了PHP中Head::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Head::instance方法的具体用法?PHP Head::instance怎么用?PHP Head::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Head
的用法示例。
在下文中一共展示了Head::instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
/**
* returns the instance created by its first invoke.
*
* @return Head
*/
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->session = Session::instance();
$this->head = Head::instance();
$this->head->css->append_file('themes/' . config::get('s7n.theme') . '/css/layout');
$this->head->title->set(config::get('s7n.site_title'));
$this->template->set_global('theme_url', 'themes/' . config::get('s7n.theme') . '/');
$this->template->head = $this->head;
}
示例3: __construct
public function __construct()
{
$this['title'] = new Head_Title();
$this['base'] = new Head_Base();
$this['javascript'] = new Head_Javascript();
$this['css'] = new Head_Css();
$this['link'] = new Head_Link();
$this->setFlags(ArrayObject::ARRAY_AS_PROPS);
// Singleton instance
self::$instance = $this;
}
示例4: __construct
public function __construct()
{
parent::__construct();
// Load the template
$this->template = new Admin_View($this->template);
if ($this->auto_render == TRUE) {
// Render the template immediately after the controller method
Event::add('system.post_controller', array($this, '_render'));
}
$this->session = Session::instance();
$this->db = Database::instance();
// check if user is logged in or not. also check if he has admin role
if (!Auth::factory()->logged_in('admin')) {
$this->session->set('redirect_me_to', url::current());
url::redirect('admin/auth/login');
}
$this->head = Head::instance();
// Javascripts
$this->head->javascript->append_file('vendor/jquery/jquery.js');
$this->head->javascript->append_file('vendor/jquery/jquery-ui.min.js');
$this->head->javascript->append_file('vendor/jquery/ui/ui.tree.js');
$this->head->javascript->append_file('themes/admin/js/stuff.js');
// Stylesheets
$this->head->css->append_file('themes/admin/css/ui/jquery-ui');
$this->head->css->append_file('themes/admin/css/layout');
$this->head->css->append_file('themes/admin/css/ui.tabs');
$this->head->title->set('S7Nadmin');
$this->template->set_global('tasks', array());
$this->template->set_global('sidebar', array());
$this->template->title = '';
$this->template->message = $this->session->get('info_message', NULL);
$this->template->error = $this->session->get('error_message', NULL);
$this->template->content = '';
$this->template->set_global('head', $this->head);
$this->template->searchbar = FALSE;
$this->template->searchvalue = '';
}
示例5: render
/**
* Returns the rendered head tag
* @param boolean echo result
* @return string
*/
public function render($output = false)
{
// Set content-type header
//Header('Content-Type: '.$this->contenttype.';; charset='.$this->charset);
if (substr(Kohana::VERSION, 0, 3) == '3.0') {
$request = Request::instance();
} else {
$request = Request::current();
}
$request->headers['Content-Type'] = $this->contenttype . '; charset=' . $this->charset;
$html = $this->xhtml_doctype;
$html .= '<html' . Html::attributes($this->htmlatts_all) . '>';
$html .= Head::instance();
$html .= '<body>' . $this->body . '</body>';
$html .= '</html>';
// Tidy
if (extension_loaded('tidy') and Kohana::config('xhtml.tidy_output')) {
$tidyconfig = Kohana::config('xhtml.tidy_config');
//$tidyconfig['output-xml'] = true;
$charset = str_replace('-', '', $this->charset);
$tidy = new tidy();
$tidy->parseString($html, $tidyconfig, $charset);
$tidy->cleanRepair();
$html = (string) $tidy;
}
//Output
if ($output) {
echo $html;
}
return $html;
}