CodeIgniter 3.0ã§Twigã使ã
æ代ã¯Twigã§ã
ãã®EC-CUBEããã¼ã¸ã§ã³3ãããã³ãã¬ã¼ãã¨ã³ã¸ã³ãTwigã«å¤æ´ãã¾ãã
åææ¥ã«ãã£ãOSC Nagoyaã§æãã¦ããã£ãã®ã§ãããå®ã¯Twigã«ã¯ãé åããªãã¸ã§ã¯ãããããï¼.ï¼ã§è¡¨ç¾ã§ããã¨ããå§åçãªåªä½æ§ãããã¾ããã
Twigã§ã¯$foo['bar']
ã$foo->bar
ã$foo->bar()
ã以ä¸ã®ããã«è¡¨ç¾ã§ãã¾ãã
{{ foo.bar }}
ãã£ãããã¦ã¾ããã
ã¨ãããã¨ã§ãCodeIgniterã§ãTwigã使ãããã¨æãã¾ãã
CodeIgniter Simple and Secure Twig
CodeIgniterã§Twigãç°¡åã«ä½¿ãããã«ãCodeIgniter Simple and Secure Twigãã¨ãããã¼ã«ãä½æãã¾ããã
ãã ããããã¯æ¢åã®PHPãã³ãã¬ã¼ããç°¡åã«ç½®ãæãã§ããããã«ããã·ã³ãã«ãªå®è£ ã§ãã
è¦æ¨¡ã大ãããªãå ´åããã£ã¨æ©è½ã欲ããå ´åã¯ãhttps://gitlab.com/david-sosa-valdes/ci-twig ãè¦ãã¨ããããç¥ãã¾ããã
ã¤ã³ã¹ãã¼ã«æ¹æ³
Composerã§ã¤ã³ã¹ãã¼ã«ãã¦ãã ããã
$ cd /path/to/codeigniter/
$ composer require kenjis/codeigniter-ss-twig:1.0.x@dev
$ php vendor/kenjis/codeigniter-ss-twig/install.php
ããã§å®äºã§ãã
ãã£ã¦ããã¨ã¯ãTwigãComposerã§ã¤ã³ã¹ãã¼ã«ããCodeIgniterç¨ã®Twigã©ã¤ãã©ãªã以ä¸ã«ã³ãã¼ãã¦ããã ãã§ãã
codeigniter/
âââ application/
âââ libraries/
âââ Twig.php
ã¨ãããã¨ã§ãä½ããã¦ãããã¯ä¸è¨ã®Twig.php
ãè¦ãã°ãã¹ã¦ãããã¾ãã
使ãæ¹
Twigã©ã¤ãã©ãªããã¼ããã¾ãã
$this->load->library('Twig');
以ä¸ã§ãã³ãã¬ã¼ãï¼views/welcome.twig
ï¼ãã¬ã³ããªã³ã°ããã¾ãã
(2016-01-26 追è¨) ã¡ã½ããåãæ´æ°ãã¾ããã
$this->twig->display('welcome', $data);
ããã ãã§ãã
CodeIgniterã®ãã«ãã¼ã«ã¤ãã¦
ç¾å¨ã以ä¸ã®ãã«ãã¼ã使ããããã«ãªã£ã¦ãã¾ããä¸é¨ã®ãã«ãã¼ã§ã¯ã¨ã¹ã±ã¼ãå¦çã追å ãã¦å®å ¨ã«ãã¦ããã¾ãã
- base_url
- site_url
- form_open
- form_close
- form_error
- set_value
- form_hidden
- anchor
ãµã³ãã«
å®éã®Twigãã³ãã¬ã¼ããè¦ããå ´åã¯ã以ä¸ã®ã¢ããªã®*.twig
ãã¡ã¤ã«ãåç
§é¡ãã¾ãã
ãªãããã®ã¢ããªã®ã³ã¼ãã¬ãã¥ã¼ãåéãã¦ãã¾ãã
ã¾ã¨ã
- æ代ã¯Twigã§ãã
- CodeIgniter Simple and Secure Twigã使ãã¨ç°¡åã«CodeIgniter 3.0ã§Twigã使ãã¾ãã
é¢é£
- CodeIgniter 3.0ã§PHPUnitã使ã
- CodeIgniter 3.0ã®ã¢ããªãã³ã¼ãã¬ãã¥ã¼ãã¦ãã ãã
- Codeigniter 3.0ã§ãã¤ã°ã¬ã¼ã·ã§ã³ãCLIããæä½ããCli for CodeIgniter
- Codeigniter 3.0ãã³ãã³ãä¸çºã§ã¤ã³ã¹ãã¼ã«ããCodeIgniter Composer Installer
- 2015å¹´ææ°PHPãã¬ã¼ã ã¯ã¼ã¯ï¼9ã¤ï¼ã®ãã³ããã¼ã¯
- CodeIgniter 3ã®ã©ã¤ã»ã³ã¹ãMITã©ã¤ã»ã³ã¹ã«å¤æ´ãããããããã©ã¤ã»ã³ã¹åé¡ã¯å®å ¨ã«è§£æ¶
- CodeIgniterã®æ°åãCodeIgniter Web Application Blueprintsããåºã¦ã¾ãã
Date: 2015/05/25