My view appears twice |
[eluser]Dready[/eluser]
As wiredesignz was telling you, you have double output because the "index" method is called twice : once when the object is created, and once when code igniter, through the routing process, call the default method. To be a little more explicit : Code: class testme { This code will echo "hi there !"; And now if you try : Code: class testme { When you have a controller with "index" as the class name , and you hit the URL http://youserver/index.php/index , codeigniter first create an object of your controller ( new Index() ) and because the default method called by codeigniter is "index", and because in your URL you didn't specify another method, codeigniter then call your "index" method once again. Now if you create another method inside your controller, for example : Code: class Index extends controller { and then you hit the URL http://youserver/index.php/index/foo it will echo "in index in foo ". To resume if I were you I wouldn't make a controller having "index" a the class name. Good luck. |
Messages In This Thread |
My view appears twice - by El Forum - 09-29-2008, 02:57 PM
My view appears twice - by El Forum - 09-29-2008, 09:37 PM
My view appears twice - by El Forum - 09-30-2008, 12:27 AM
My view appears twice - by El Forum - 09-30-2008, 03:23 AM
My view appears twice - by El Forum - 09-30-2008, 04:12 AM
My view appears twice - by El Forum - 09-30-2008, 04:19 AM
My view appears twice - by El Forum - 09-30-2008, 04:29 AM
My view appears twice - by El Forum - 09-30-2008, 04:36 AM
My view appears twice - by El Forum - 09-30-2008, 04:43 AM
My view appears twice - by El Forum - 09-30-2008, 04:54 AM
My view appears twice - by El Forum - 09-30-2008, 07:11 AM
My view appears twice - by El Forum - 09-30-2008, 07:25 AM
My view appears twice - by El Forum - 09-30-2008, 07:35 AM
My view appears twice - by El Forum - 09-30-2008, 08:20 AM
My view appears twice - by El Forum - 09-30-2008, 08:28 AM
My view appears twice - by El Forum - 09-30-2008, 08:45 AM
My view appears twice - by El Forum - 09-30-2008, 08:50 AM
My view appears twice - by El Forum - 09-30-2008, 08:56 AM
My view appears twice - by El Forum - 09-30-2008, 09:03 AM
|