Dans le cadre d'un developpement, j'ai eu besoin de réaliser des affichages dans des iframes.

<?php
/**
*	@desc		Classe d'Iframe
*	@author 	NSN <nicolas.suprin@cactuscrew.com>
*	@copyright	2005
*/	
define('SCROLLING', 'yes');
define('NOSCROLLING', 'no');
 
class Iframe {
	
	/**
	*	@var 	array	$A_attributes	tableau des attributs
	*	@access private
	*/	
	private $A_attributes;
	
	
	/**
	*	@var 	string	$S_noframe Message si le navigateur ne gere pas les iframes {src} pour afficher le lien
	*	@access private
	*/
	private $S_noframe;
	
	
	/**
	*	@desc		Constructeur
	*	@author 	NSN <nicolas.suprin@cactuscrew.com>
	*	@param		String nom de la frame
	*	@param 		String source
	*	@return		void
	*	@copyright	2005
	*/	
	public function __construct($S_nom = '', $S_src = '', $A_attributs = array()) {
		$this->_init();
		$this->setName(			$S_nom);
		$this->setSrc(			$S_src);
		$this->setAttributes(	$A_attributs);
			
	}
	
	
	/**
	*	@desc		Initialisation des parametres
	*	@author 	NSN <nicolas.suprin@cactuscrew.com>
	*	@param		void
	*	@return		void
	*	@copyright	2005
	*/	
	private function _init() {
		$this->A_attributes	= array();
		$this->setName(			'DefaultIframe');
		$this->setFrameborder(	0);
		$this->setHeight(		'100%');
		$this->setWidth(		'100%');
		$this->setScrolling(	false);
		$this->S_noframe	= 'Your browser doesn\'t works with iframe, but you can open the page in {src}';
		
	}
	
	
	/**
	*	@desc		Retourne l'HTML de l'iframe
	*	@author 	NSN <nicolas.suprin@cactuscrew.com>
	*	@param		void
	*	@return		String
	*	@copyright	2005
	*/	
	public function toHtml() {
 
		$S_return	= '';
		$S_return 	.= '<iframe' ;
 
		if (is_array($this->A_attributes) && sizeof($this->A_attributes) > 0) {
			foreach ($this->A_attributes as $S_name => $S_value) {
				$S_return .= ' '.$S_name.'="'.$S_value.'"';
				
			}
			
		}
		
		$S_return 	.=  '>'."\n";
		$S_return	.= "\t".preg_replace('/{src}/', 
									'<a href="'.$this->getSrc().'">'.$this->getSrc().'</a>', 
									$this->S_noframe)."\n";
		
		$S_return	.= '</iframe>'."\n";
 
		return $S_return;		
		
	}
	
	
	// --- Accesseurs
	// --- GET
	public function getName() {
		return $this->getAttributes('name');
		
	}
	
	
	public function getScrolling() {
		$B_return	= false;
		if ($this->getAttributes('scrolling') == SCROLLING) {
			$B_return	= true;
			
		}
		return $B_return;
		
	}
	
	
	public function getSrc() {
		return $this->getAttributes('src');
		
	}
	
	
	public function getWidth() {
		return $this->getAttributes('width');
		
	}
	
	
	public function getHeight() {
		return $this->getAttributes('height');
			
	}
	
	
	public function getFrameborder() {
		return $this->getAttributes('frameborder');
			
	}
	
	public function getAttributes($S_index = null) {
		$S_return	= null;
		if (is_null($S_index)) {
			$S_return	= $this->A_attributes;
			
		} elseif (isset($this->A_attributes{$S_index})) {
			$S_return	= $this->A_attributes{$S_index};
			
		}
		return $S_return;
		
	}
	
	public function getNoiframeMsg() {
		return $this->S_noframe;
		
	}
	
	
	// --- SET
	public function setName($S_param) {
		$this->setAttributes(array('name' => $S_param));
		
	}
	
	
	public function setScrolling($S_param) {
		$B_etat	= NOSCROLLING;
		if ($S_param) {
			$B_etat	= SCROLLING;
		}
		$this->setAttributes(array('scrolling' => $B_etat));
		
	}
	
	
	public function setSrc($S_param) {
		$this->setAttributes(array('src' => $S_param));
		
	}
	
	
	public function setWidth($S_param) {
		$this->setAttributes(array('width' => $S_param));
		
	}
	
	
	public function setHeight($S_param) {
		$this->setAttributes(array('height' => $S_param));
			
	}
	
	
	public function setFrameborder($S_param) {
		$this->setAttributes(array('frameborder' => $S_param));
			
	}
	
	public function setStyle($S_param) {
		$this->setAttributes(array('style' => $S_param));
		
	}
	
	public function setAttributes($A_attributes) {
		if (is_array($A_attributes)) {
			foreach ($A_attributes as $S_attrib => $S_value) {
				$this->A_attributes{strtolower($S_attrib)}	= $S_value;
				
			}			
			
		}
		
	}
	
	public function setNoiframeMsg($S_msg) {
		$this->S_noframe	= $S_msg;
		
	}
		
}
?>


Un exemple d'appel :

require_once 'Iframe/C_Iframe.php';
 
$O_iframe	= new Iframe('essai iframe', 'http://google.fr');
 
// Je veux pas de scroll
$O_iframe->setScrolling(false); 
 
// Largeur
$O_iframe->setWidth('600'); 
 
// hauteur
$O_iframe->setHeight('500'); 
 
// Je change la source
$O_iframe->setSrc('http://blog.cactuscrew.com/'); 
 
// je change la hauteur
$O_iframe->setAttributes(array('height' => 700)); 
 
// Je change le style
$O_iframe->setStyle('border: 10px dotted #FF0000;'); 
 
// Message si les iframes ne sont pas pris en charge
$O_iframe->setNoiframeMsg('Votre navigateur ne supporte pas les iframes, continuez ici : {src}'); 
 
// Affichage
echo $O_iframe->toHtml();