Summary: PHP - CodeIgniter (CI) And Sublime Text 2
Recently in touch CI, we found a handy tool SublimeText 2,
Long as follows:
I found easy to use than Notepad ++.
Because I need a different file switch, but I have to switch between different folders of data, with the left side of the file structure, it is a lot easier.
People in need, can go to download their own
http://www.sublimetext.com/2
To learn CI, the first step,
To download CI
http://www.codeigniter.org.tw/downloads
I downloaded version 2.2.0
The downloading of the entire folder,
Copied to the root directory underneath.
I stand with XAMPP Apache,
So I put C: // xampp / htdocs /
Because I just want to test,
So I put C: // xampp / htdocs / test / ci
If you put the right words, index.php data will be placed in this folder (and application, system) folder
I will this time, the test program put
https://github.com/newmonkey48/citest
The main folders are measured from the document read on the way to practice.
The mysql, to create a table
as follows
CREATE TABLE news ( id int(11) NOT NULL AUTO_INCREMENT, title varchar(128) NOT NULL, slug varchar(128) NOT NULL, text text NOT NULL, PRIMARY KEY (id), KEY slug (slug) );
Every time a new main page,
You might move to
application/controllers
application/views
application/config/routes/php
因为他默认的方式,会是[base_url]/index.php/[controller]/[action]/[id]
但为了不要打index.php直接打[base_url]/[controller]/[action]/[id]
需在index.php,同层(htdocs/test/ci/)里新增.htaccess
内容如下
ON RewriteEngineRewriteBase /
RewriteCond $ 1 ^! (Index.php | Asset | SIMAGES | | a robots.txt $)
(. *) $ RewriteRule ^ the Test / CI / index.php / $ 1 [L, QSA]
so that you can directly use [ base_url] / [controller] / [ action] / [id], browse the page.
Again, in order to integrate Twitter-Bootstrap
to refer to the
https://github.com/sjlu/CodeIgniter-Bootstrap
his assets, copied to the test / ci.
To refer to the bootstrap css then use the following command but because the controller needs to base_url time, it is necessary under the $ this-> load-> helper ( ' url'); but if every time this is very troublesome, it can go to the application /config/autoload.php modify the $ autoload [ 'helper'] = array ( 'url'); so there's Bootstrap CSS can quote then because I used to practice many programs are placed controllers / sample and views / sample so routes.php would change about the route
$ route [ 'calendar'] = 'sample / calendar';
then how Mandarin system
I built tw folder in the application / language /,
file put index_lang.php,
; $ lang [ 'language_key'] = "xxxx"
when used may be
the controller for an operation such as
$ this-> lang-> load ( ' index', 'tw');
the view command
echo $ language_key = $ this-> lang- > line ( 'language_key');
Original: Big Box PHP - CodeIgniter (CI) And Sublime Text 2