本文整理汇总了PHP中Content::append方法的典型用法代码示例。如果您正苦于以下问题:PHP Content::append方法的具体用法?PHP Content::append怎么用?PHP Content::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Content
的用法示例。
在下文中一共展示了Content::append方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_admin_forms
echo $body;
} else {
/*
* Create a container for our content.
*/
$content = new Content();
/*
* Define some page elements.
*/
$content->set('browser_title', 'Admin');
$content->set('body_class', 'inside');
/*
* Put the shorthand $body variable into its proper place.
*/
$content->set('body', '<div class="nest narrow">');
$content->append('body', '<h1>Admin</h1>');
$content->append('body', $body);
$content->append('body', '</div>');
unset($body);
/*
* Parse the template, which is a shortcut for a few steps that culminate in sending the content
* to the browser.
*/
$template = Template::create('admin');
$template->parse($content);
}
function show_admin_forms($args = array())
{
$parser = new ParserController($args);
$editions = $parser->get_editions();
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
示例2: foreach
<?php
if ($_SESSION['debugmode']) {
Content::addAdditionalJS('debugmode.js');
Content::append(<<<EOT
<h4 id="debugInfoHead">Debug details</h4>
<div id="debugInfo" style="display: none;"><h4>Logging Output</h4>
\t\t<table>
\t\t\t<tr>
\t\t\t\t<th>Time from start</th>
\t\t\t\t<th>Value</th>
\t\t\t</tr>
EOT
);
$first = true;
foreach (Log::getLog() as $logent) {
if ($first === true) {
$first = $logent['time'];
}
$timefromstart = $logent['time'] - $first;
Content::append("\n\t\t\t<tr>\n\t\t\t\t<td>{$timefromstart}</td>\n\t\t\t\t<td>{$logent['val']}</td>\n\t\t\t</tr>");
}
Content::append(<<<EOT
\t\t</table>
\t<h4>Current Global Vars</h4>
\t\t<pre>
EOT
);
Content::append(print_r($GLOBALS, true));
Content::append('</pre></div>');
}
示例3: Content
* Create a container for our content.
*/
$content = new Content();
/*
* Define the title page elements.
*/
if (strlen($structure_id) > 0) {
$content->set('browser_title', $struct->name);
$content->set('page_title', '<h2>' . $struct->name . '</h2>');
} else {
$content->set('browser_title', SITE_TITLE . ': The ' . LAWS_NAME . ', for Humans.');
}
/*
* Make some section information available globally to JavaScript.
*/
$content->append('javascript', "var api_key = '" . API_KEY . "';");
/*
* Define the breadcrumb trail.
*/
if (count((array) $structure) > 1) {
foreach ($structure as $level) {
$active = '';
if ($level == end($structure)) {
$active = 'active';
}
$content->append('breadcrumbs', '<li class="' . $active . '">
<a href="' . $level->url . '">' . $level->identifier . ': ' . $level->name . '</a>
</li>');
/*
* If this structural element is the same as the parent container, then use that knowledge
* to populate the link rel="up" tag.
示例4: redirect
<?php
if (!isset($_SESSION['debugmode'])) {
$_SESSION['debugmode'] = false;
}
if ($slug == "debugmode") {
if (!isset($params[0])) {
Content::set("Your current debug mode state is: " . ($_SESSION['debugmode'] ? 'ON' : 'OFF'));
Content::append("<form action='/debugmode/" . (!$_SESSION['debugmode'] ? 'on' : 'off') . "'><input type='submit' value='Click to toggle' /></form>");
} else {
if ($params[0] == 'on') {
$_SESSION['debugmode'] = true;
redirect('/debugmode', true);
} else {
$_SESSION['debugmode'] = false;
redirect('/debugmode', true);
}
}
}
示例5: Content
*/
echo $law->plain_text;
/*
* End processing and exit.
*/
exit;
}
/*
* Create a container for our content.
*/
$content = new Content();
/*
* Make some section information available globally to JavaScript.
*/
$content->set('javascript', "var section_number = '" . $law->section_number . "';");
$content->append('javascript', "var law_id = '" . $law->law_id . "';");
$content->append('javascript', "var edition_id = '" . $law->edition_id . "';");
$content->append('javascript', "var api_key = '" . API_KEY . "';");
/*
* Define the browser title.
*/
$content->set('browser_title', $law->catch_line . ' (' . SECTION_SYMBOL . ' ' . $law->section_number . ')—' . SITE_TITLE);
/*
* Define the page title.
*/
$content->set('page_title', '<h1>' . SECTION_SYMBOL . ' ' . $law->section_number . '</h1>');
$content->append('page_title', '<h2>' . $law->catch_line . '</h2>');
/*
* If we have Dublin Core metadata, display it.
*/
if (is_object($law->dublin_core)) {
示例6: ucwords
*/
$body = '';
/*
* Define the title page elements.
*/
if (strlen($structure_id) > 0) {
$content->set('browser_title', $struct->name);
$content->set('page_title', '<h2>' . $struct->name . '</h2>');
} else {
$content->set('browser_title', SITE_TITLE . ': The ' . LAWS_NAME . ', for Humans.');
$content->set('page_title', '<h2>' . ucwords($children->{0}->label) . 's of the ' . LAWS_NAME . '</h2>');
}
/*
* Make some section information available globally to JavaScript.
*/
$content->append('javascript', "var api_key = '" . API_KEY . "';");
/*
* Define the breadcrumb trail.
*/
if (count((array) $structure) > 1) {
foreach ($structure as $level) {
$active = '';
if ($level == end($structure)) {
$active = 'active';
}
$content->append('breadcrumbs', '<li class="' . $active . '">
<a href="' . $level->url . '">' . $level->identifier . ': ' . $level->name . '</a>
</li>');
/*
* If this structural element is the same as the parent container, then use that knowledge
* to populate the link rel="up" tag.
示例7: Content
*/
echo $law->plain_text;
/*
* End processing and exit.
*/
exit;
}
/*
* Create a container for our content.
*/
$content = new Content();
/*
* Make some section information available globally to JavaScript.
*/
$content->set('javascript', "var section_number = '" . $law->section_number . "';");
$content->append('javascript', "var section_id = '" . $law->section_id . "';");
$content->append('javascript', "var api_key = '" . API_KEY . "';");
/*
* Define the browser title.
*/
$content->set('browser_title', $law->catch_line . ' (' . SECTION_SYMBOL . ' ' . $law->section_number . ')—' . SITE_TITLE);
/*
* Define the page title.
*/
$content->set('page_title', '<h1>' . SECTION_SYMBOL . ' ' . $law->section_number . '</h1>');
$content->append('page_title', '<h2>' . $law->catch_line . '</h2>');
/*
* If we have Dublin Core metadata, display it.
*/
if (is_object($law->dublin_core)) {
$content->set('meta_tags', '');
示例8: chdir
<?php
if ($slug == "git") {
Content::$forcedTitle = "Git Update";
if (count($params) > 0) {
chdir(HR_ROOT);
Content::setContent("\n\t\t\t<h1>Updating website from git...</h1>\n\t\t\t<pre>" . `echo Running git reset --hard && git reset --hard 2>&1 && echo Running git pull && git pull` . "</pre><br />\n\t\t\t<h3>Now pulling latest commit information from Github...</h3>\n\t\t");
inclib('github/lib/phpGitHubApi.php');
$phpGH = new phpGitHubApi();
$phpGH->authenticate('lukegb', '3b4e0c11ee0681db035b0e885147e236', phpGitHubAPI::AUTH_HTTP_TOKEN);
$latestCommits = $phpGH->getCommitApi()->getBranchCommits('robbiet480', 'hRepo', 'master');
$gitCommit = array('long' => $latestCommits[0]['id'], 'short' => substr($latestCommits[0]['id'], 0, 7), 'userid' => $latestCommits[0]['author']['login'], 'commitdate' => $latestCommits[0]['committed_date']);
file_put_contents(HR_ROOT . '/gitcommit.txt', serialize($gitCommit));
Content::append('<p>Last git commit: ' . $gitCommit['long'] . ' by ' . $gitCommit['userid'] . '</p>');
} else {
Content::setContent("\n\t\t\t<h1>Authorisation code incorrect or missing</h2>\n\t\t\t<p>Git update did not go through.</p>\n\t\t");
}
}
示例9:
if ($total_results > $per_page) {
$search->total_results = $total_results;
$search->per_page = $per_page;
$search->page = $page;
$search->query = $q;
$body .= $search->display_paging();
}
/*
* Close the #search-results div.
*/
$body .= '</div>';
/*
* If there is a next and/or previous page of results, include that in the HTML head.
*/
if (isset($search->prev)) {
$content->append('link_rel', '<link rel="prev" title="Previous" href="' . $search->prev . '" />');
}
if (isset($search->next)) {
$content->append('link_rel', '<link rel="next" title="Next" href="' . $search->next . '" />');
}
}
} else {
$body .= $search->display_form();
}
/*
* Put the shorthand $body variable into its proper place.
*/
$content->set('body', $body);
unset($body);
/*
* Put the shorthand $sidebar variable into its proper place.