How to apply a decorator in a structure views, knowing that only a single view is responsible for executing the block of code to render the template? as:
<?php
class View {
public function render ( $template ) {
printf ( 'Rendering template %s' , $template ) ;
}
}
class MemberView { }
class AdministratorView { }
$Admin = new MemberView ( new AdministratorView ( ) ) ;
$Admin->render ( ) ;
In this case, I am rendering an administrator, but when going through the drivers, will acquire and the basic functions that every member has reached the view and perform to show panels, or things that only administrators can see, but in logic, a administrator is also a member .. so the structure has to be made, applies to moderators, global moderators ..
My question is that of how to apply the decorator in this case ..
Well, we managed to solve the problem .. the solution:
The output: Rendering template Administrator
If I remove the rendering of the administrator.
The output: Rendering template Member