本文整理汇总了PHP中Pages::getPagesList方法的典型用法代码示例。如果您正苦于以下问题:PHP Pages::getPagesList方法的具体用法?PHP Pages::getPagesList怎么用?PHP Pages::getPagesList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pages
的用法示例。
在下文中一共展示了Pages::getPagesList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
public function editAction()
{
if ($this->_hasParam('id')) {
$constId = $this->_getParam('id');
if ($this->_request->isPost()) {
$val = $this->_request->getPost('value');
$this->siteDbAdapter->update('const', array('c_value' => trim($val)), $this->siteDbAdapter->quoteInto('c_id = ?', $constId));
$this->_redirect('/constants/list/');
}
if ($this->existConstants[$constId]['c_name'] == 'un404page' || $this->existConstants[$constId]['c_name'] == 'loginPage') {
$pages = new Pages($this->getSiteId());
$pagesList = $pages->getPagesList();
$this->tplVars['consts']['val']['pages'] = $pagesList;
}
$this->tplVars['consts']['val']['value'] = $this->existConstants[$constId]['c_value'];
$this->tplVars['consts']['val']['name'] = $this->existConstants[$constId]['c_name'];
array_push($this->tplVars['header']['actions']['names'], array('name' => 'edit', 'menu_name' => 'Edit Constant'));
array_push($this->viewIncludes, 'constants/editConstant.tpl');
}
}
示例2: sitemapAction
public function sitemapAction()
{
$pages = new Pages($this->getSiteId());
$data = array();
if ($this->_request->getPost('generate')) {
$data['action'] = 'generate';
$pagesList = $pages->getPagesList();
$hostname = $this->getNCSiteHostname();
$sitemap = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
foreach ($pagesList as $page) {
$pg_options = unserialize($page['pg_options']);
if ($page['pg_hidden'] == '0' && !isset($pg_options['noIndex'])) {
$sitemap .= '<url><loc>http://' . $hostname . '' . $page['pg_address'] . '</loc></url>' . "\n";
}
}
$sitemap .= '</urlset>';
if (file_exists($pages->getSitePath() . 'sitemap.xml')) {
copy($pages->getSitePath() . 'sitemap.xml', $pages->getSitePath() . 'tmp/sitemap_' . date('Y-m-d_H-i-s') . '.xml');
}
if (file_put_contents($pages->getSitePath() . 'sitemap.xml', $sitemap)) {
$data['result'] = true;
$data['sitemap_link'] = 'http://' . $hostname . '/sitemap.xml';
} else {
$data['result'] = false;
}
}
// function uploading a new sitemap file to the root of the site
if ($this->_request->getPost('max_file_size') && count($_FILES)) {
$data['action'] = 'uploadfile';
$allowed_to_upload = false;
$hostname = $this->getNCSiteHostname();
$uploadfile = $pages->getSitePath() . basename($_FILES['uploadfile']['name']);
if (file_exists($pages->getSitePath() . 'sitemap.xml')) {
if (copy($pages->getSitePath() . 'sitemap.xml', $pages->getSitePath() . 'tmp/sitemap_' . date('Y-m-d_H-i-s') . '.xml')) {
$allowed_to_upload = true;
} else {
$data['result'] = false;
$data['message'] = 'Cannot copy the old sitemap file';
}
if (!unlink($uploadfile)) {
$data['result'] = false;
$data['message'] = 'Cannot remove the old sitemap file';
}
} else {
$allowed_to_upload = true;
}
// if($_FILES['uploadfile']['size'] > $this->_request->getPost('max_file_size')){
// $allowed_to_upload = false;
// $data['message'] = 'Maximum file size to upload is '.sprintf("%u", filesize($uploadfile));
// }
if ($allowed_to_upload) {
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $uploadfile)) {
$data['result'] = true;
$data['message'] = 'Your request was completed successfully!';
$data['sitemap_link'] = 'http://' . $hostname . '/sitemap.xml';
} else {
$data['result'] = false;
$data['message'] = 'Cannot copy the new sitemap file';
}
} else {
$data['result'] = false;
$data['message'] = 'Something has happened, the new sitemap file was not allowed to upload...';
}
}
$this->tplVars['data'] = $data;
array_push($this->viewIncludes, 'content/sitemap.tpl');
}
示例3: getPages
public function getPages($smarty = FALSE, $siteId)
{
$pages = new Pages($siteId);
$prods = $pages->getPagesList(NULL, array('pg_lang', 'pg_address'));
if ($smarty) {
$tcats['values'] = array();
$tcats['names'] = array();
$tsize = sizeof($prods);
for ($i = 0; $i < $tsize; $i++) {
array_push($tcats['values'], $prods[$i]['pg_address']);
array_push($tcats['names'], $prods[$i]['pg_address']);
}
$prods = $tcats;
}
return $prods;
}