4 ms·
Uh, no - templates are scoped to the function or method in which they are called. They are only global if you include the template globally. class MyTempla
by debaserab2 7y ago
Uh, no - templates are scoped to the function or method in which they are called. They are only global if you include the template globally.
class MyTemplate {
function displayTemplate() {
include 'mytemplate.php'; // mytemplate.php has access to only class properties.
// Anything declared within mytemplate.php is scoped to the displayTemplate function.
}
}
- codesushi42 7y agoUh, that is a contrived example not suggested by the op. You can still embed PHP into HTML.
- debaserab2 7y agoUsing class methods to scope template variables is contrived? Huh?
- codesushi42 7y agoYou can still embed PHP into HTML.