CodeIgniter Forums
My view appears twice - 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: My view appears twice (/showthread.php?tid=11949)

Pages: 1 2


My view appears twice - El Forum - 09-29-2008

[eluser]Plume[/eluser]
Hi people !

I'm not sure to be in the right forum. Not sure to understand correctly the title of each one.

I'm taking control of CI. I'm using Layout Librairy ( http://codeigniter.com/wiki/layout_library/ ). And since I'm trying to organize controllers in different sub folders, I'm seeing my entire view appears twice.

I mean the entire main layout, course Smile

What do you need ? Do you know what's my problem ?

Thanks !

@tchaOo°


My view appears twice - El Forum - 09-29-2008

[eluser]Sumon[/eluser]
Best place to post your thread is http://codeigniter.com/wiki/layout_library/ page. Click "Start a discussion about this article!" and post your problem.


My view appears twice - El Forum - 09-30-2008

[eluser]Plume[/eluser]
I don't think so because I had this problem since I'm trying to organize my controllers in sub folder. The fact I'm using Layout Library was to informm you of all informations I thought good to tell you Smile

@tchaOo°


My view appears twice - El Forum - 09-30-2008

[eluser]Plume[/eluser]
Get the organization :
; I have a controller index.php, located in controller/home/, containing :
Code:
<?php
class Index extends Controller{
    
    function Index(){
      
      parent::Controller();
      $this->layout->view('home/index');
    }
}
; I have a view index.php, located in view/home/, only containing text for test.

Need something else ?

I don't see the problem cause when I'm not organizing controller in sub folder, I don't have this one.

So strange ! :o


My view appears twice - El Forum - 09-30-2008

[eluser]Yash[/eluser]
show me full code....


My view appears twice - El Forum - 09-30-2008

[eluser]wiredesignz[/eluser]
It's pretty simple really. `index` is the constructor method and also the default method used by CI when running controllers.

So your index() method is called during instantiation and again to run the controller.

Index is also a reserved word, so don't use it to name controllers. Tongue


My view appears twice - El Forum - 09-30-2008

[eluser]xwero[/eluser]
Wiredesingz index doesn't appear in the reserved word list and i was under the impression methods are case sensitive. The router should pick up that the controller is named Index.


My view appears twice - El Forum - 09-30-2008

[eluser]wiredesignz[/eluser]
@xwero, the router has nothing to do with PHP object instantiation. And I have never seen any checks for object/method name clashes in CI.

Methods are not case sensitive (under PHP5 at least), maybe you could check PHP4 Tongue

Apologies if the word `index` doesn't appear in the reserved word list. Maybe it should.


My view appears twice - El Forum - 09-30-2008

[eluser]Dready[/eluser]
Hello,

PHP class names are case-insensitive, no deal with CI. The index keyword should perhaps be added to the list of reserved words, but did you read controller documentation before starting coding your first controller ? The "index" thing is very well explained in there.


My view appears twice - El Forum - 09-30-2008

[eluser]Plume[/eluser]
[quote author="Yash" date="1222787551"]show me full code....[/quote]
I would well but which one ? Smile

Quote:Hello,

PHP class names are case-insensitive, no deal with CI. The index keyword should perhaps be added to the list of reserved words, but did you read controller documentation before starting coding your first controller ? The “index” thing is very well explained in there.
Yes, I read ( what is the preterit ? :/ ) And it worked when I don't organizing with sub folder. It's why I don't understand.

@Wiredesingz :
I'll try with some different named controller but, I never changed this during my first tests :/

Thanks for help folks !

I'll tell you what it will become Smile