Page 1 of 1

[SOLVED]About the global method used in controller class

Posted: Thu Dec 08, 2011 11:00 am
by wangllam
I saw controller class use global methods
eg. $this->document->getTitle();
but there is no document object defined in the controller class, i want to know how the getTitle() call as I could not found a class member "document" inside the controller class
also where can i find the controller class get instantiated?

Re: About the global method used in controller class

Posted: Thu Dec 08, 2011 1:57 pm
by straightlight
Incorrect. There's a document object from index.php file and admin/index.php file which then gets registered in order to be globalized within the entire catalog and another one within the entire admin.

Code: Select all

// Document
$document = new Document();
$registry->set('document', $document);

Re: About the global method used in controller class

Posted: Thu Dec 08, 2011 1:58 pm
by rph
/index.php
/system/library/document.php

Re: About the global method used in controller class

Posted: Thu Dec 08, 2011 2:08 pm
by wangllam
straightlight wrote:Incorrect. There's a document object from index.php file and admin/index.php file which then gets registered in order to be globalized within the entire catalog and another one within the entire admin.

Code: Select all

// Document
$document = new Document();
$registry->set('document', $document);
thank you very much ;D
then I try to understand what index.php doing inside

Re: [SOLVED]About the global method used in controller class

Posted: Thu Dec 08, 2011 2:17 pm
by straightlight
The index.php is mainly as inclusively considered global.php file mixed with an index definition while we compare with non-CMS platform applications. ;)