本文整理匯總了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;
}