cvs: pear /HTML_Page Page.php

From: Date: Tue, 29 Jul 2003 22:07:43 +0000
Subject: cvs: pear /HTML_Page Page.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-11810@lists.php.net to get a copy of this message
thesaur Tue Jul 29 18:07:43 2003 EDT Modified files: /pear/HTML_Page Page.php Log: * fix linked script and stylesheet support (thanks to Leandro Lucarella) * fix notice in unsetBody() Index: pear/HTML_Page/Page.php diff -u pear/HTML_Page/Page.php:1.20 pear/HTML_Page/Page.php:1.21 --- pear/HTML_Page/Page.php:1.20 Sun Jul 27 11:02:44 2003 +++ pear/HTML_Page/Page.php Tue Jul 29 18:07:42 2003 @@ -17,7 +17,7 @@ // | Klaus Guenther <klaus@capitalfocus.org> | // +----------------------------------------------------------------------+ // -// $Id: Page.php,v 1.20 2003/07/27 15:02:44 thesaur Exp $ +// $Id: Page.php,v 1.21 2003/07/29 22:07:42 thesaur Exp $ require_once 'PEAR.php'; require_once 'HTML/Common.php'; @@ -432,10 +432,8 @@ } // Generate stylesheet links - $count = count($this->_styleSheets); - for($intCounter=0; $intCounter < $count; $intCounter++) { - $strStyleSheet = $this->_styleSheets[$intCounter]; - $strHtml .= $tab . "<link rel=\"stylesheet\" href=\"$strStyleSheet\" type=\"text/css\"" . $tagEnd . $lnEnd; + foreach ($this->_styleSheets as $strSrc => $strType ) { + $strHtml .= $tab . "<link rel=\"stylesheet\" href=\"$strSrc\" type=\"$strType\"" . $tagEnd . $lnEnd; } // Generate stylesheet declarations @@ -481,10 +479,7 @@ } // Generate script file links - $count = count($this->_scripts); - for($intCounter=0; $intCounter < $count; $intCounter++) { - $strType = $this->_scripts[$intCounter]["type"]; - $strSrc = $this->_scripts[$intCounter]["src"]; + foreach ($this->_scripts as $strSrc => $strType) { $strHtml .= $tab . "<script type=\"$strType\" src=\"$strSrc\"></script>" . $lnEnd; } @@ -698,7 +693,7 @@ */ function addScript($url, $type="text/javascript") { - $this->_scripts[] = array("type"=>$type, "src"=>$url); + $this->_scripts[$url] = $type; } // end func addScript /** @@ -723,9 +718,9 @@ * @access public * @return void */ - function addStyleSheet($url) + function addStyleSheet($url, $type = 'text/css') { - $this->_styleSheets[] = $url; + $this->_styleSheets[$url] = $type; } // end func addStyleSheet /** @@ -832,7 +827,7 @@ */ function unsetBody() { - $this->_body = ''; + $this->_body = array(); } // end unsetBody /** @@ -1047,4 +1042,4 @@ } // end func display } -?> \ No newline at end of file +?>

« previous php.pear.cvs (#11810) next »