A simple MVC sample, but cannot work well with loading model... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: A simple MVC sample, but cannot work well with loading model... (/showthread.php?tid=23279) Pages:
1
2
|
A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]mrmu[/eluser] Hi all, I'm a CodeIgniter beginner and I got some problems while I tried to re-write the blog example of CodeIgniter tutorial video. I want to use "load model" to demo a simple MVC structure, but I failed, there is nothing shown on my screen but a full blank. I'd like to post the codes and hope someone can help me! First, I create a database called "test" with a table "entries" (includes id, title, body 3 columns) as the blog example and I also add 2 records in it. I also set this in the config/autoload.php: Code: $autoload['libraries'] = array('database'); {Controller} blog.phpit can work if I mark B,C without A.) Code: <?php {Model} blog_model.php: Code: <?php {View} blog_view.php: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> Thank you!! A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]imn.codeartist[/eluser] Instead of Code: $this->load->model('blog_model'); Code: $this->load->model('Blog_model'); A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]mrmu[/eluser] Hi dixcoder, Thank you for reply! But it still cannot work! :-( A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]imn.codeartist[/eluser] try Code: <? before you loop the query and post the result here A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]mrmu[/eluser] Hi dixcoder, I add the code as below, but still nothing shown on, the html resource is empty! (firefox 3.5.3) Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]imn.codeartist[/eluser] Code: class Blog_model extends Model { print what is returning by getdata function Code: function getdata() A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]m4d3 Gun[/eluser] try this.... in ur model.... Quote: and view.... Quote: A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]mrmu[/eluser] Hi dixcoder, Still cannot work...nothing happend! Hi m4d3, Thanks for reply, but still nothing happend too. Are they works on your mechine? :-( A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]imn.codeartist[/eluser] paste your mysql table script here and database info from config A simple MVC sample, but cannot work well with loading model... - El Forum - 10-06-2009 [eluser]mrmu[/eluser] Here is SQL script: Code: SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; database settings: Code: $active_group = "default"; Thank you! |