Welcome Guest, Not a member yet? Register   Sign In
My view appears twice
#1

[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°
#2

[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.
#3

[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°
#4

[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
#5

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

[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
#7

[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.
#8

[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.
#9

[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.
#10

[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




Theme © iAndrew 2016 - Forum software by © MyBB