ååãfuelphpã§pjaxãæ±ãã§ããç»é¢ã ããpjaxã®jsã©ã¤ãã©ãªãå¿
è¦ã ã£ãã
ãã³ãã¬ã¼ãã®ãã¼ã¹ã§ãããtemplateãã¡ã¤ã«ã«pjaxã®ã©ã¤ãã©ãªã®ãã¹ã
æ¸ãã¦ãã¾ãã¨ã使ã£ã¦ãªãç»é¢ã¾ã§ãã®ã©ã¤ãã©ãªãå¼ã°ãã¦ç¡é§ã
ãã¨è¨ã£ã¦ãåå¥ãã³ãã¬ã¼ãã§ãã®ã©ã¤ãã©ãªãå¼ã¶ã®ãããã¦ãªãã
assetsãå©ç¨ãã¦ãã®åé¡ã解決ã§ããã
â ã³ã³ããã¼ã©ã¼
class Controller_Welcome extends Controller_Template
{
ãpublic function action_index()
ã{
ããAsset::css(array('bootstrap.min.css', 'bootstrap-responsive.min.css','bootswatch.css'), array(), 'add_css', false);
ãã$this->template->content = View::forge('welcome/index');
ã}
â»ããã§ã'add_css'ã£ã¦ããã°ã«ã¼ããç»é²ãã¦ãã
â ãã³ãã¬ã¼ã
<!DOCTYPE html>
<html lang="ja">
ã<head>
ãã<meta charset="utf-8">
ãã<?php echo Asset::css('å ¨ã¦ã®ãã³ãã¬ã¼ãã§å¼ã¶.css'); ?>
ãã<?php echo Asset::js('å ¨ã¦ã®ãã³ãã¬ã¼ãã§å¼ã¶.js'); ?>
ãã<!-- ç»é¢åºæã®CSS -->
ãã<?php echo Asset::render('add_css');?>
ããã§ãã³ã³ããã¼ã©ã¼å´ã§ãadd_cssã°ã«ã¼ãã«ãCSSãã¡ã¤ã«ãã¢ãµã¤ã³
ããã¦ããã¨ãã ããç»é¢åºæã®CSSã表示ãããããã«ãªãã
ã¡ãªã¿ã«ã
<?php echo Asset::render('add_css',true);?>
ã£ã¦ããã¨ãå¤é¨ãã¡ã¤ã«ãå¼ã¶ã®ã§ã¯ãªãã¦ãå¤é¨ãã¡ã¤ã«ãããã«
å±éããã
ãªãã»ã©ã
ãã³ãã¬ã¼ãã®ãã¼ã¹ã§ãããtemplateãã¡ã¤ã«ã«pjaxã®ã©ã¤ãã©ãªã®ãã¹ã
æ¸ãã¦ãã¾ãã¨ã使ã£ã¦ãªãç»é¢ã¾ã§ãã®ã©ã¤ãã©ãªãå¼ã°ãã¦ç¡é§ã
ãã¨è¨ã£ã¦ãåå¥ãã³ãã¬ã¼ãã§ãã®ã©ã¤ãã©ãªãå¼ã¶ã®ãããã¦ãªãã
assetsãå©ç¨ãã¦ãã®åé¡ã解決ã§ããã
â ã³ã³ããã¼ã©ã¼
class Controller_Welcome extends Controller_Template
{
ãpublic function action_index()
ã{
ããAsset::css(array('bootstrap.min.css', 'bootstrap-responsive.min.css','bootswatch.css'), array(), 'add_css', false);
ãã$this->template->content = View::forge('welcome/index');
ã}
â»ããã§ã'add_css'ã£ã¦ããã°ã«ã¼ããç»é²ãã¦ãã
â ãã³ãã¬ã¼ã
<!DOCTYPE html>
<html lang="ja">
ã<head>
ãã<meta charset="utf-8">
ãã<?php echo Asset::css('å ¨ã¦ã®ãã³ãã¬ã¼ãã§å¼ã¶.css'); ?>
ãã<?php echo Asset::js('å ¨ã¦ã®ãã³ãã¬ã¼ãã§å¼ã¶.js'); ?>
ãã<!-- ç»é¢åºæã®CSS -->
ãã<?php echo Asset::render('add_css');?>
ããã§ãã³ã³ããã¼ã©ã¼å´ã§ãadd_cssã°ã«ã¼ãã«ãCSSãã¡ã¤ã«ãã¢ãµã¤ã³
ããã¦ããã¨ãã ããç»é¢åºæã®CSSã表示ãããããã«ãªãã
ã¡ãªã¿ã«ã
<?php echo Asset::render('add_css',true);?>
ã£ã¦ããã¨ãå¤é¨ãã¡ã¤ã«ãå¼ã¶ã®ã§ã¯ãªãã¦ãå¤é¨ãã¡ã¤ã«ãããã«
å±éããã
ãªãã»ã©ã
â»ã³ã¡ã³ãæ稿è ã®ããã°IDã¯ããã°ä½æè ã®ã¿ã«éç¥ããã¾ã