wordpress-like model to view api event system (MVC)

7331

New Member
Wordpress has a nice api system. I'm struggling in creating an equal flexible one using a more traditional MVC interpretation. A typical view class could be like this:\[code\]class View{ public function set($name, $value) { $this->data[$name] = $value } public function __get($name) ... you know how it works}\[/code\]A use case would be a controller adding an order contain order lines:\[code\]$view->add('order', $orderModel);\[/code\]Then the template file could have something like\[code\]foreach ($this->order->getOrderLines() as $orderLine){ ?><div><?php echo $orderLine->getItemName(); ?><div><?php}\[/code\]At least this is what is commonly seen in many PHP MVC frameworks. I'm open to alternative implementations that solve the question:How to add an event system like wordpress has? Eg a filter OrderLineItemName.
 
Back
Top