data['Identite']['raisonSociale'] = 'PEUGEOT'; } public function assignVars() { $this->view = new VueHtml(realpath(dirname(__FILE__)).'/Templates/fiche.phtml'); foreach($this->data['Identite'] as $var => $value){ $this->view->{$var} = $value; } } public function getContent(){ $this->execRequete(); $this->assignVars(); return $this->view->getHtml(); } } class VueHtml { protected $includeVue = array(); public function __construct($filename) { if (is_array($filename)){ $this->includeVue = $filename; } else { $this->includeVue = array($filename); } } public function getHtml() { $content = ''; foreach( $this->includeVue as $f ) { if ( is_file( $f ) ) { ob_start(); include $f; $content.= ob_get_contents(); ob_end_clean(); } } return $content; } } $rapport = new Rapport(); echo $rapport->getContent();