Bad Practice requiring file within a model?
- by Lee Marshall
I have built an MVC php application and was wondering, if instead of having to write out a large amount of html and set the data, could I not just have all this html (with some php) in a separate file and just require it?
For example:
$test = '<div>
Test content
<div>More content</div>
</div>';
$APP->Template->setData('test', $test, FALSE);
Instead could I not just use:
$test = require("includes/content.php");
$APP->Template->setData('test', $test, FALSE);
Would this be considered as bad practise? It just seems that by requiring files, it can shorten the length of controllers.
Would be good to get anybodies advice on this matter.