Hot to call Superclass contructor method from subclass constructor method with parent::construct() in codeigniter custom - 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: Hot to call Superclass contructor method from subclass constructor method with parent::construct() in codeigniter custom (/showthread.php?tid=48162) |
Hot to call Superclass contructor method from subclass constructor method with parent::construct() in codeigniter custom - El Forum - 01-06-2012 [eluser]Unknown[/eluser] A have few games in my application, and each game have some shared functionality. For each game i created library in application/libraries/games/ directory (all files are located in that directory). One game have one file which name is the same as game name. Here is pseudocode for 'Writeitright' game: file Writeitright.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); file Game.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); in my controller file i have just: Code: $this->load->library('game/Writeitright'); I expected output like that: Quote:1. Hello from parentBut i got only second line. I tried to add a prefix 'MY_' to my files and change class names to have prefix, but it does not work I think that include Game.php file into Writeitright.php should help but is that a good way to solve problem? |