本文整理汇总了PHP中HTML_Page2::display方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Page2::display方法的具体用法?PHP HTML_Page2::display怎么用?PHP HTML_Page2::display使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Page2
的用法示例。
在下文中一共展示了HTML_Page2::display方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function _renderForm(&$page)
{
$pageName = $page->getAttribute('name');
$tabPreview = array_slice($page->controller->_tabs, -2, 1);
$tab = ' ';
$p = new HTML_Page2(array('lineend' => PHP_EOL, 'tab' => $tab, 'doctype' => 'XHTML 1.0 Strict', 'language' => 'en', 'cache' => 'false'));
$p->disableXmlProlog();
$p->setTitle('PEAR::HTML_Progress2 - Generator');
$p->setMetaData('author', 'Laurent Laville');
$styles = '
body {
background-color: #7B7B88;
font-family: Verdana, Arial, helvetica;
font-size: 10pt;
}
h1 {
color: #FFC;
text-align: center;
}
.maintable {
width: 100%;
border-width: 0;
border-style: thin dashed;
border-color: #D0D0D0;
background-color: #EEE;
cellspacing: 2;
cellspadding: 3;
}
th {
text-align: center;
color: #FFC;
background-color: #AAA;
white-space: nowrap;
}
input {
font-family: Verdana, Arial, helvetica;
}
input.flat {
border-style: solid;
border-width: 2px 2px 0 2px;
border-color: #996;
}
';
// on preview tab, add progress bar javascript and stylesheet
if ($pageName == $tabPreview[0][0]) {
$pb = $page->controller->createProgressBar();
$pb->setTab($tab);
$p->addStyleDeclaration($styles . $pb->getStyle());
$p->addScriptDeclaration($pb->getScript());
$pbElement =& $page->getElement('progressBar');
$pbElement->setText($pb->toHtml() . '<br /><br />');
} else {
$p->addStyleDeclaration($styles);
}
$formTemplate = "\n<form{attributes}>" . "\n<table style=\"font-size: 8pt;\" class=\"maintable\">" . "\n{content}" . "\n</table>" . "\n</form>";
$headerTemplate = "\n<tr>" . "\n\t<th colspan=\"2\">" . "\n\t\t{header}" . "\n\t</th>" . "\n</tr>";
$elementTemplate = "\n\t<tr>" . "\n\t\t<td align=\"right\" valign=\"top\" width=\"30%\">" . "<!-- BEGIN required --><span style=\"color: #ff0000\">*</span><!-- END required -->" . "<b>{label}</b></td>" . "\n\t\t<td valign=\"top\" align=\"left\">" . "<!-- BEGIN error --><span style=\"color: #ff0000\">{error}</span><br /><!-- END error -->" . "\t{element}</td>" . "\n\t</tr>";
$groupTemplate = "<table><tr>{content}</tr></table>";
$groupElementTemplate = "<td>{element}<br />" . "<span style=\"font-size:10px;\">" . "<span class=\"label\">{label}</span>" . "</span></td>";
$renderer =& $page->defaultRenderer();
$renderer->setFormTemplate($formTemplate);
$renderer->setHeaderTemplate($headerTemplate);
$renderer->setElementTemplate($elementTemplate);
$renderer->setGroupTemplate($groupTemplate, 'name');
$renderer->setGroupElementTemplate($groupElementTemplate, 'name');
$page->accept($renderer);
$p->addBodyContent($renderer->toHtml());
$p->display();
}
示例2: Validator
$page->addScript('js/scriptaculous/scriptaculous.js');
$page->addScriptDeclaration($additional_js);
$page->setBodyAttributes(array('onLoad' => $onLoad));
//,'onKeyPress'=>'keyPressShowDiv(event.keyCode)'
$page->addBodyContent($header_and_menu);
$page->addBodyContent('<div id="content">');
$page->addBodyContent($navbar);
$page->addBodyContent($form->renderForm());
$page->addBodyContent('</div>');
$page->addBodyContent('<div id="hint" style="background-color:#FFFFFF"></div><script type="text/javascript">
new Ajax.Autocompleter("con_company","hint","ajax_contact.php");
</script>');
if ($msg) {
$page->addBodyContent($msg);
}
$page->display();
/*
echo '
<script language="JavaScript" type="text/javascript">
//You should create the validator only after the definition of the HTML form
var frmvalidator = new Validator("testForm");
frmvalidator.addValidation("con_fname","req","Forename(s) is required");
frmvalidator.addValidation("con_sname","req","Surname is required");
frmvalidator.addValidation("con_email","req","Email is required");
frmvalidator.addValidation("con_email","email","Email is invalid");
</script>';
*/
示例3:
/**
* Outputs the form.
*
* @param object &$page the page being processed
*
* @return void
* @access public
* @since version 2.0.0RC1 (2005-06-23)
*/
function _renderForm(&$page)
{
$tab = ' ';
$p = new HTML_Page2(array('lineend' => PHP_EOL, 'tab' => $tab, 'doctype' => 'XHTML 1.0 Strict', 'language' => 'en', 'cache' => 'false'));
$p->disableXmlProlog();
$p->setTitle('PEAR::HTML_Progress2 - Generator');
$p->setMetaData('author', 'Laurent Laville');
$formTemplate = "\n<form{attributes}>" . "\n<table class=\"maintable\">" . "\n<caption>HTML_Progress2 Generator</caption>" . "\n{content}" . "\n</table>" . "\n</form>";
$headerTemplate = "\n<tr>" . "\n\t<th colspan=\"2\">" . "\n\t\t{header}" . "\n\t</th>" . "\n</tr>";
$elementTemplate = "\n<tr valign=\"top\">" . "\n\t<td class=\"qfLabel\"> " . "<!-- BEGIN required -->" . "<span class=\"required\">*</span>" . "<!-- END required -->" . "{label}</td>" . "\n\t<td class=\"qfElement\">" . "\n{element}" . "<!-- BEGIN label_2 --> " . "<span class=\"qfLabel2\">{label_2}</span>" . "<!-- END label_2 -->" . "\n\t</td>" . "\n</tr>";
$groupTemplate = "\n\t\t<table class=\"group\">" . "\n\t\t<tr>" . "\n\t\t\t{content}" . "\n\t\t</tr>" . "\n\t\t</table>";
$groupElementTemplate = "<td>{element}" . "<!-- BEGIN label --><br/>" . "<span class=\"qfLabel\">{label}</span>" . "<!-- END label -->" . "</td>";
$renderer =& $page->defaultRenderer();
$renderer->setFormTemplate($formTemplate);
$renderer->setHeaderTemplate($headerTemplate);
$renderer->setElementTemplate($elementTemplate);
$renderer->setGroupTemplate($groupTemplate, 'name');
$renderer->setGroupElementTemplate($groupElementTemplate, 'name');
$styles = $this->getStyleSheet();
$js = '';
// on preview tab, add progress bar javascript and stylesheet
if ($page->getAttribute('id') == 'Preview') {
$pb = $page->controller->createProgressBar();
$pb->setTab($tab);
$styles .= $pb->getStyle();
$js = $pb->getScript();
$p->addStyleDeclaration($styles);
$p->addScriptDeclaration($js);
$pbElement =& $page->getElement('progressBar');
$pbElement->setText($pb->toHtml() . '<br /><br />');
} else {
$p->addStyleDeclaration($styles);
}
$page->accept($renderer);
$p->addBodyContent($renderer->toHtml());
$p->display();
}