![]() |
Trying to show a single blog post - 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: Trying to show a single blog post (/showthread.php?tid=30607) |
Trying to show a single blog post - El Forum - 05-20-2010 [eluser]kaos78414[/eluser] For some reason this brings up a blank page. That's weird because it should at least load my header and footer. I'm assuming it's passing false for some reason because $blod_id does not have a value? My read more links look like this: Code: echo anchor('blog/view/'.$row->blogId, 'Read on'); Trying to show a single blog post - El Forum - 05-20-2010 [eluser]cahva[/eluser] Well $row->blogId should contain the id right? Ofcourse it doesnt work if theres no id ![]() Does it work if you just use url http://www.yourdomain.com/blog/view/12 (or any other id that exists). Trying to show a single blog post - El Forum - 05-20-2010 [eluser]kaos78414[/eluser] The link points to the correct ID. I'm really not sure what's going on here. The database returns results correctly if I just do a simple get('blogposts') active record query. Trying to show a single blog post - El Forum - 05-20-2010 [eluser]cahva[/eluser] Just add this to the view method: Code: $this->output->enable_profiler(TRUE); That will tell you the queries run + much more. Trying to show a single blog post - El Forum - 05-20-2010 [eluser]kaos78414[/eluser] Weird. No URI data, no queries. Nothing seems to be happening at all. Any ideas? Trying to show a single blog post - El Forum - 05-20-2010 [eluser]cahva[/eluser] That is weird. Does that profiler give you anything in other controllers? Trying to show a single blog post - El Forum - 05-20-2010 [eluser]kaos78414[/eluser] Nope. Under class/method it says blog/view Everything else is either benchmarks/memory usage or is empty. Trying to show a single blog post - El Forum - 05-20-2010 [eluser]cahva[/eluser] Do you use routes? Thats the only thing that I can think of.. Maybe you should paste the whole controller here so we can have a looksee. Trying to show a single blog post - El Forum - 05-20-2010 [eluser]kaos78414[/eluser] Here's the controller blog.php Code: <?php And this is the entire model file at blogmodel.php Code: <?php Trying to show a single blog post - El Forum - 05-20-2010 [eluser]cahva[/eluser] Only thing I see here that could cause problems(but I doubt) is the BlogModel's constructor: Code: function Blogmodel() { You can set the constructor with __construct() in every controller and model: Code: function __construct() But as I said, I doubt this causes the error. The error is in uri right now as you dont seem to get any vars passed to your method and is not actually related to the model itself. Do you use any kind of routes(you forgot to say that)? You said earlier that its not an htaccess issue. You sure? ![]() If this problem wont solve, you better do an clean CI install and make a test controller to see that uri works as it should. |