My template parser looks like this (p/s the .'/'. is for readability):
$this->parser->parse($this->settings['theme'].'/'.'header', $data);
$this->parser->parse($this->settings['theme'].'/'.'register', $data);
$this->parser->parse($this->settings['theme'].'/'.'footer', $data);
I don't want to declare $this->parser->parse($this->settings['theme'].'/'.'header', $data);
and $this->parser->parse($this->settings['theme'].'/'.'footer', $data);
every time in my controller's functions.
How can I extend the MY_Parser.php
so that I could use it like this instead:
$this->parser->parse($this->settings['theme'].'/'.'register', $data);
will include the register.php
between my header.php
and footer.php
automatically.
The benefit of doing this is to save 2 lines and if I have 20 functions, I can save 40 lines.