本文整理汇总了PHP中news::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP news::getAll方法的具体用法?PHP news::getAll怎么用?PHP news::getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类news
的用法示例。
在下文中一共展示了news::getAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAll
public function actionAll()
{
$news = news::getAll();
$view = new view();
$view->items = $news;
$view->display('news/all.php');
}
示例2: regenerateSiteMap
function regenerateSiteMap()
{
global $mysql, $config;
/*
* XML文件
*/
$fh = fopen($config['root_path'] . 'sitemap.xml', 'w') or die('ERROR WITH FILE OPEN');
$file = '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach ($this->langs as $language) {
$file .= '
<url>
<loc>http://' . $config['domain'] . '/' . $language . '/</loc>
<lastmod>' . date('Y-m-d') . 'T00:00:00+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>http://' . $config['domain'] . '/' . $language . '/sitemap/</loc>
<lastmod>' . date('Y-m-d') . 'T00:00:00+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>http://' . $config['domain'] . '/' . $language . '/contacts/</loc>
<lastmod>' . date('Y-m-d') . 'T00:00:00+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.9</priority>
</url>
';
}
/*
* 匹配语言
*/
foreach ($this->langs as $language) {
/*
* 页面类
*/
require_once ROOT_PATH . '/apps/pages/models/pages.class.php';
$pagesClass = new pages();
$all = $pagesClass->getAll(0, 0, " AND `visible` = 'true' ");
if (is_array($all)) {
foreach ($all as $k => $v) {
$file .= '
<url>
<loc>http://' . $config['domain'] . '/' . $language . '/pages/' . $v['key'] . '.html' . '</loc>
<lastmod>' . date('Y-m-d') . 'T00:00:00+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.9</priority>
</url>
';
}
}
/*
*
*/
require_once ROOT_PATH . '/apps/news/models/news.class.php';
$newsClass = new news();
$all = $newsClass->getAll(0, 0, " AND `visible` = 'true' ");
if (is_array($all)) {
foreach ($all as $k => $v) {
$file .= '
<url>
<loc>http://' . $config['domain'] . '/' . $language . '/news/view/' . $v['id'] . '/' . url(htmlspecialchars($v['name'])) . '.html' . '</loc>
<lastmod>' . date('Y-m-d') . 'T00:00:00+00:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
';
}
}
}
/*
* XML文件End
*/
$file .= '</urlset>';
fwrite($fh, $file);
fclose($fh);
return $file;
}