本文整理汇总了PHP中HTML_Page2::setMetaData方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Page2::setMetaData方法的具体用法?PHP HTML_Page2::setMetaData怎么用?PHP HTML_Page2::setMetaData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Page2
的用法示例。
在下文中一共展示了HTML_Page2::setMetaData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Outputs the form.
*
* @param object HTML_QuickForm_Page the page being processed
* @access public
* @since 2.0.0RC1
*/
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();
}
示例2:
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();
}
示例3:
// The initializing code can also be in in the form of an HTML
// attr="value" string.
// Possible attributes are:
// - cache ("true" or "false")
// - charset (e.g., "utf-8")
// - doctype (e.g., "XHTML Basic 1.0")
// - language (two letter designator: e.g., "en")
// - lineend ("unix", "win", "mac", custom string)
// - mime (e.g., "application/xhtml+xml")
// - namespace (URI)
// - profile (URI)
// - tab (e.g., " ")
// - disableProlog (bool)
// All the above have defaults, so it is not necessary
// to specify everything. For example, the proper namespace
// is chosen by default.
$page = new HTML_Page2(['lineend' => 'unix', 'doctype' => 'XHTML 1.0 Strict', 'language' => 'en', 'cache' => 'false', 'tab' => ' ']);
// Page title defaults to "New $doctypeString Compliant Page"
$page->setTitle("HTML_Page2 Color Chart example");
$page->setMetaData("author", "Klaus Guenther");
// let's add a Content-Type meta tag
$page->setMetaContentType();
// Objects with toHtml and toString are supported.
$page->addBodyContent($table);
$page->addBodyContent('<p>Copyright 2003 The PHP Group</p>');
// oops, forgot to add the header:
$page->addBodyContent("<h1>Color Chart</h1>", HTML_PAGE2_PREPEND);
// output to browser
$page->display();
// or to a file
//$page->toFile('example.html');