@@ -20,7 +20,7 @@ public function index()//index公共函数,主页
2020 $ this ->load ->view ('home ' , $ data );//加载视图
2121 }
2222
23- public function article ($ id )
23+ public function article ($ id )//文章详情页
2424 {
2525 $ data ['rows ' ] = $ this ->home_model ->article ($ id );
2626 $ this ->load ->view ('article ' , $ data );
@@ -33,13 +33,25 @@ public function about()
3333
3434 public function tweets ()
3535 {
36- $ data ['rows ' ] = $ this ->home_model ->tweets ();
36+ $ config ['base_url ' ]='http://cc.com:89/home/tweets ' ;
37+ $ config ['total_rows ' ]=$ this ->db ->get ("tweets " )->num_rows ();
38+ $ config ['per_page ' ]=10 ;
39+ $ config ['num_links ' ]=100 ;
40+ $ this ->pagination ->initialize ($ config );
41+
42+ $ data ['rows ' ] = $ this ->home_model ->tweets ($ config );
3743 $ this ->load ->view ('tweets ' , $ data );
3844 }
3945
4046 public function diaries ()
4147 {
42- $ data ['rows ' ] = $ this ->home_model ->diaries ();
48+ $ config ['base_url ' ]='http://cc.com:89/home/diaries ' ;
49+ $ config ['total_rows ' ]=$ this ->db ->get ("diaries " )->num_rows ();
50+ $ config ['per_page ' ]=8 ;
51+ $ config ['num_links ' ]=100 ;
52+ $ this ->pagination ->initialize ($ config );
53+
54+ $ data ['rows ' ] = $ this ->home_model ->diaries ($ config );
4355 $ this ->load ->view ('diaries ' , $ data );
4456 }
4557
@@ -50,13 +62,25 @@ public function photos()
5062
5163 public function learn ()
5264 {
53- $ data ['rows ' ] = $ this ->home_model ->learn ();
65+ $ config ['base_url ' ]='http://cc.com:89/home/learn ' ;
66+ $ config ['total_rows ' ]=$ this ->db ->get ("article " )->num_rows ();
67+ $ config ['per_page ' ]=8 ;
68+ $ config ['num_links ' ]=100 ;
69+ $ this ->pagination ->initialize ($ config );
70+
71+ $ data ['rows ' ] = $ this ->home_model ->learn ($ config );
5472 $ this ->load ->view ('learn ' , $ data );
5573 }
5674
5775 public function guestbook ()
5876 {
59- $ data ['rows ' ] = $ this ->home_model ->guestbook ();
77+ $ config ['base_url ' ]='http://cc.com:89/home/guestbook ' ;
78+ $ config ['total_rows ' ]=$ this ->db ->get ("guestbook " )->num_rows ();
79+ $ config ['per_page ' ]=8 ;
80+ $ config ['num_links ' ]=100 ;
81+ $ this ->pagination ->initialize ($ config );
82+
83+ $ data ['rows ' ] = $ this ->home_model ->guestbook ($ config );
6084 $ this ->load ->view ('guestbook ' , $ data );
6185 }
6286
@@ -68,8 +92,8 @@ public function message()//留言功能
6892 }
6993 elseif ($ this ->input ->post ('name ' ) && $ this ->input ->post ('content ' ) && $ this ->input ->post ('date ' ) != null )
7094 {
71- $ name = $ this ->input ->post ('name ' );
72- $ content = $ this ->input ->post ('content ' );
95+ $ name = $ this ->security -> xss_clean ( $ this -> input ->post ('name ' )); //XSS攻击防护
96+ $ content = $ this ->security -> xss_clean ( $ this -> input ->post ('content ' ) );
7397 $ date = $ this ->input ->post ('date ' );
7498 $ result = $ this ->home_model ->message ($ name , $ content , $ date );
7599
0 commit comments