RE: [PEAR] HTML_Page (or Page2) and framesets
| From: | Matte Edens | Date: | Mon, 28 Jun 2004 06:06:59 +0000 |
| Subject: | RE: [PEAR] HTML_Page (or Page2) and framesets | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-13367@lists.php.net to get a copy of this message | ||
I have thrown together two functions and a tweak of the toHtml() function. These are from the CVS
files but I don't have CVS access so they are the straight code, not a diff. Sorry. If it
isn't up to PEAR code requirements I again apologize.
// {HTML/Page2/Frameset.php} --------<snip snip>--------------
function setBorder($border)
{
$this->_border = $border;
} // end func setBorder
function getBorder()
{
if ($this->_border >= 0)
{
return ' border="' . $this->_border . '"
frameborder="' . $this->_border . '"';
}
} // end func setBorder
function toHTML()
{
// get line endings
$lnEnd = $this->_getLineEnd();
$tab = $this->_getTab();
$tabs = $this->_getTabs();
$offset = $this->getTabOffset();
if ($this->xhtml === true) {
$tagEnd = ' />';
} else {
$tagEnd = '>';
}
if (count($this->_rows) > 0) {
$type = 'rows';
$sizesStr = implode(', ', $this->_rows);
} else {
$type = 'cols';
$sizesStr = implode(', ', $this->_cols);
}
$strHtml = $tabs . '<frameset ' . $type . '="' . $sizesStr ..
'"' . $this->getBorder() . '>' . $lnEnd;
$type = '_' . $type;
foreach (array_keys($this->$type) as $name) {
if(strtolower(get_class($this->$name)) == 'html_page2_frameset') {
$this->$name->setTabOffset($offset + 1);
$this->$name->setTab($tab);
$this->$name->setLineEnd($lnEnd);
$this->$name->xhtml = $this->xhtml;
// fetch the
$strHtml .= $this->$name->toHtml();
} else {
$this->$name->xhtml = $this->xhtml;
$strHtml .= $tabs . $tab . $this->$name->toHtml() . $lnEnd;
}
}
if (!$this->_master) {
$strHtml .= $tabs . '</frameset>' . $lnEnd;
}
return $strHtml;
} // end func toHtml
// {HTML/Page2/Frameset.php} --------<snip snip>--------------
-----Original Message-----
From: Klaus Guenther [mailto:klaus@capitalfocus.org]
Sent: Thu 6/24/2004 10:23 AM
To: Matte Edens
Cc: pear-general@lists.php.net
Subject: Re: [PEAR] HTML_Page (or Page2) and framesets
Klaus Guenther wrote:
> Matte Edens wrote:
>
>> off the top of my head couldn't there be something like this (until
>> there's an HTML_Frameset package) ...
>>
>> $frameset = $page->createFrameset(array $attributes);
>> $frameset->addFrame(array $attributes);
>> $page->addBodyContent('To view this page properly, your browser must
>> support framesets.');
>> $page->addFrameset($frameset);
>
>
> Today I'll try to write HTML_Page2_Frameset, an instance of which will
> be located at $page->frameset, and it can be nested at will.
Check out CVS. There is an example in there, too.
Klaus