本文整理汇总了PHP中Url::sort方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::sort方法的具体用法?PHP Url::sort怎么用?PHP Url::sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url::sort方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($params)
{
$Log_Model = new Log_Model();
$CACHE = Cache::getInstance();
$options_cache = Option::getAll();
extract($options_cache);
$page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
$sortid = '';
if (!empty($params[2])) {
if (is_numeric($params[2])) {
$sortid = intval($params[2]);
} else {
$sort_cache = $CACHE->readCache('sort');
foreach ($sort_cache as $key => $value) {
$alias = addslashes(urldecode(trim($params[2])));
if (array_search($alias, $value, true)) {
$sortid = $key;
break;
}
}
}
}
$pageurl = '';
$sort_cache = $CACHE->readCache('sort');
if (!isset($sort_cache[$sortid])) {
show_404_page();
}
$sort = $sort_cache[$sortid];
$sortName = $sort['sortname'];
//page meta
$site_title = $sortName . ' - ' . $site_title;
if (!empty($sort_cache[$sortid]['description'])) {
$site_description = $sort_cache[$sortid]['description'];
}
if ($sort['pid'] != 0 || empty($sort['children'])) {
$sqlSegment = "and sortid={$sortid}";
} else {
$sortids = array_merge(array($sortid), $sort['children']);
$sqlSegment = "and sortid in (" . implode(',', $sortids) . ")";
}
$sqlSegment .= " order by sortop desc, date desc";
$lognum = $Log_Model->getLogNum('n', $sqlSegment);
$total_pages = ceil($lognum / $index_lognum);
if ($page > $total_pages) {
$page = $total_pages;
}
$pageurl .= Url::sort($sortid, 'page');
$logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
$page_url = pagination($lognum, $index_lognum, $page, $pageurl);
$template = !empty($sort['template']) && file_exists(TEMPLATE_PATH . $sort['template'] . '.php') ? $sort['template'] : 'log_list';
include View::getView('header');
include View::getView($template);
}
示例2: setData
private function setData()
{
$CACHE = Cache::getInstance();
$data = array();
$lastCommentTime = $this->getLastCommentTime();
$data[] = array('url' => BLOG_URL, 'lastmod' => time(), 'changefreq' => 'always', 'priority' => '1.0');
//日志
$query = $this->db->query("SELECT gid,date FROM " . DB_PREFIX . "blog WHERE type='blog' AND hide='n' ORDER BY date DESC");
while ($row = $this->db->fetch_array($query)) {
$lastmod = $this->comment_time && isset($lastCommentTime[$row['gid']]) ? $lastCommentTime[$row['gid']] : $row['date'];
$data[] = array('url' => Url::log($row['gid']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[0], 'priority' => $this->priority[0]);
}
//页面
$query = $this->db->query("SELECT gid,date FROM " . DB_PREFIX . "blog WHERE type='page' AND hide='n' ORDER BY date DESC");
while ($row = $this->db->fetch_array($query)) {
$lastmod = $this->comment_time && isset($lastCommentTime[$row['gid']]) ? $lastCommentTime[$row['gid']] : $row['date'];
$data[] = array('url' => Url::log($row['gid']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[0], 'priority' => $this->priority[0]);
}
//分类
foreach ($CACHE->readCache('sort') as $value) {
$data[] = array('url' => Url::sort($value['sid']), 'lastmod' => time(), 'changefreq' => $this->changefreq[2], 'priority' => $this->priority[2]);
}
//标签
foreach ($CACHE->readCache('tags') as $value) {
$data[] = array('url' => Url::tag($value['tagurl']), 'lastmod' => time(), 'changefreq' => $this->changefreq[3], 'priority' => $this->priority[3]);
}
//碎语
if (Option::get('istwitter') == 'y') {
$newtws_cache = $CACHE->readCache('newtw');
$data[] = array('url' => BLOG_URL . 't/', 'lastmod' => $newtws_cache[0]['date'], 'changefreq' => $this->changefreq[4], 'priority' => $this->priority[4]);
}
//归档
foreach ($CACHE->readCache('record') as $value) {
preg_match("/^([\\d]{4})([\\d]{2})\$/", $value['date'], $match);
$days = getMonthDayNum($match[2], $match[1]);
$lastmod = emStrtotime($value['date'] . '01') + 3600 * 24 * $days;
$data[] = array('url' => Url::record($value['date']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[5], 'priority' => $this->priority[5]);
}
$this->data = $data;
}
示例3: blog_sort
function blog_sort($blogid)
{
global $CACHE;
$log_cache_sort = $CACHE->readCache('logsort');
?>
<?php
if (!empty($log_cache_sort[$blogid])) {
?>
<a href="<?php
echo Url::sort($log_cache_sort[$blogid]['id']);
?>
"><?php
echo $log_cache_sort[$blogid]['name'];
?>
</a>
<?php
}
}
示例4: blog_title_sort
function blog_title_sort($blogid)
{
global $CACHE;
$log_cache_sort = $CACHE->readCache('logsort');
if (!empty($log_cache_sort[$blogid])) {
echo '<a href="' . Url::sort($log_cache_sort[$blogid]['id']) . '" class="article_triggle">' . $log_cache_sort[$blogid]['name'] . '<i></i></a>';
} else {
echo '<a href="' . BLOG_URL . '" class="article_triggle">未分类<i></i></a>';
}
}
示例5: navi
/**
* 获取导航链接
*/
static function navi($type, $typeId, $url)
{
$sorts = Cache::getInstance()->readCache('sort');
switch ($type) {
case Navi_Model::navitype_custom:
case Navi_Model::navitype_home:
case Navi_Model::navitype_t:
case Navi_Model::navitype_admin:
$url = $url;
break;
case Navi_Model::navitype_sort:
$url = Url::sort($typeId);
break;
case Navi_Model::navitype_page:
$url = Url::log($typeId);
break;
default:
$url = (strpos($url, 'http') === 0 ? '' : BLOG_URL) . $url;
break;
}
return $url;
}
示例6: foreach
if (!empty($value['children'])) {
?>
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold">
<a class="collapsible-header waves-effect waves-light"><?php
echo $value['naviname'];
?>
</a>
<div class="collapsible-body">
<ul>
<?php
foreach ($value['children'] as $row) {
?>
<li><a class="waves-effect waves-light" href="<?php
echo Url::sort($row['sid']);
?>
" ><?php
echo $row['sortname'];
?>
</a></li>
<?php
}
?>
</ul>
</div>
</li>
</ul>
</li>
<?php
}
示例7:
<?php
}
?>
</ul>
</div>
<div class="right_4">
<?php
//国内外街舞艺术精品
$sortid = 8;
?>
<div class="title"><a href="<?php
echo Url::sort($sortid);
?>
">街舞艺术.国内外街舞艺术精品</a></div><div class="more"><a href="<?php
echo Url::sort($sortid);
?>
">更多></a></div>
<ul class="right_5">
<?php
$sqlSegment = "and sortid={$sortid} order by sortop DESC,date DESC";
$logs = $Log_Model->getLogsForHome($sqlSegment, 1, 9);
foreach ($logs as $value) {
?>
<li>
<a href="<?php
echo $value['log_url'];
?>
"><?php
echo $value['log_title'];
?>
示例8: foreach
echo $value['lognum'];
?>
)
</a>
<?php
if (!empty($value['children'])) {
?>
<ul>
<?php
$children = $value['children'];
foreach ($children as $key) {
$value = $sort_cache[$key];
?>
<li>
<a class="light red-text text-lighten-2" href="<?php
echo Url::sort($value['sid']);
?>
">
<?php
echo $value['sortname'];
?>
(<?php
echo $value['lognum'];
?>
)
</a>
</li>
<?php
}
?>
</ul>
示例9: gmdate
echo gmdate('Y-n-j', $value['date']);
?>
</time>
<a class="light margin-right" href="<?php
echo Url::author($value['author']);
?>
">
<?php
echo $user_cache[$value['author']]['name'];
?>
</a>
<?php
if (!empty($log_cache_sort[$value['logid']])) {
?>
<a class="light red-text text-lighten-2 margin-right" href="<?php
echo Url::sort($log_cache_sort[$value['logid']]['id']);
?>
">
<?php
echo $log_cache_sort[$value['logid']]['name'];
?>
</a>
<?php
}
?>
<?php
if (ROLE == ROLE_ADMIN || $value['author'] == UID) {
?>
<a href="<?php
echo BLOG_URL;
?>
示例10: getNowPageSortUrl
/**
* @des 获取当前页面的导航url 用于导航定位
* @param $logData 文章数据 查看博文是存在数据
* @param $logs 文章数据数组 分类下或首页存在
* @return array ['isSigle'=>boolean,'chirldSortUrl'=>string,'parentSortUrl'=>string]
*/
function getNowPageSortUrl($logData = null, $logs = null)
{
global $CACHE;
$logSort = $CACHE->readCache('sort');
//博客内文章分类信息数组 pid!=0则为子分类
$chirldSort = array();
//子分类数组 key为子分类sortid
foreach ($logSort as $key => $value) {
if ($value['pid'] != 0) {
$chirldSort[$value['sid']] = $value;
}
}
//$urlModel = Option::get('isurlrewrite');//获取博客Url模式
$nowUrl = BLOG_URL . trim(Dispatcher::setPath(), '/');
//当前访问的url
/*文章页*/
if ($logData) {
$sortid = $logData['sortid'];
//文章分类id 未分类或单独页面会显示成-1
$logid = $logData['logid'];
//文章id
$isSigle = $sortid < 0;
//是否页面、无分类
if ($isSigle) {
return array('isSigle' => true, 'chirldSortUrl' => $nowUrl, 'parentSortUrl' => $nowUrl);
}
/*检测是否子分类下的文章*/
$sortUrl = Url::sort($sortid);
//文章分类url、可能是子分类
if (array_key_exists($sortid, $chirldSort)) {
return array('isSigle' => false, 'chirldSortUrl' => $sortUrl, 'parentSortUrl' => Url::sort($chirldSort[$sortid]['pid']));
} else {
return array('isSigle' => false, 'chirldSortUrl' => $sortUrl, 'parentSortUrl' => $sortUrl);
}
}
/*碎语*/
if (isTwiterPage()) {
return array('isSigle' => false, 'chirldSortUrl' => BLOG_URL . 't', 'parentSortUrl' => BLOG_URL . 't');
}
/*列表页*/
if ($logs) {
if (isWebIndex()) {
//首页情况 直接返回博客url
return array('isSigle' => false, 'chirldSortUrl' => BLOG_URL, 'parentSortUrl' => BLOG_URL);
}
$sortid = $logs[0]['sortid'];
$sortUrl = Url::sort($sortid);
$nowSort = preg_replace('/\\/page\\/\\d+/', '', preg_replace('/&page=\\d+/', '', $nowUrl));
if (array_key_exists($sortid, $chirldSort) && $nowSort == $sortUrl) {
return array('isSigle' => false, 'chirldSortUrl' => $sortUrl, 'parentSortUrl' => Url::sort($chirldSort[$sortid]['pid']));
} else {
return array('isSigle' => false, 'chirldSortUrl' => $nowSort, 'parentSortUrl' => $nowSort);
}
}
//特例情况 存在分类 但没有数据的
return array('isSigle' => false, 'chirldSortUrl' => $nowUrl, 'parentSortUrl' => $nowUrl);
}
示例11:
<?php
}
?>
</div>
<div class="container light padding-top" id="content">
<?php
echo $log_content;
?>
<div class="margin-vertical">
<?php
if (!empty($log_cache_sort[$logid])) {
?>
<span class="light red-text text-lighten-2">分类: </span>
<a class="light red-text text-lighten-2" href="<?php
echo Url::sort($log_cache_sort[$logid]['id']);
?>
">
<?php
echo $log_cache_sort[$logid]['name'];
?>
</a>
<?php
}
?>
/
<div class="tag" style="display: inline-block;">
<span class="light red-text text-lighten-2">标签: </span>
<?php
if (!empty($log_cache_tags[$logid])) {
?>
示例12: utl_tool_convertToMobile
<?php
//对外合作
$sortid = 5;
?>
<div class="spaceline"></div>
<div class="title"><a href="<?php
echo utl_tool_convertToMobile(Url::sort($sortid));
?>
">对外合作</a>
<?php
$Sort_Model = new Sort_Model();
$sorts = $Sort_Model->getChildSorts($sortid);
$sort_ids_str = $sortid;
foreach ($sorts as $val) {
$sort_ids_str .= ',' . $val['sid'];
echo " | <a class=\"title_1\" href=\"" . utl_tool_convertToMobile(Url::sort($val['sid'])) . "\">{$val['sortname']}</a>";
}
?>
</div>
<div class="spaceline"></div>
<ul class="left_4">
<?php
$sqlSegment = "and sortid IN ({$sort_ids_str}) order by sortop DESC,date DESC";
$logs = $Log_Model->getLogsForHome($sqlSegment, 1, 6);
$cover_img = '';
foreach ($logs as $value) {
?>
<li>
<?php
blog_cover($value['logid'], $cover_img, 230, 137);
?>
示例13: foreach
$cache['changefreq'] = 'Weekly';
$cache['priority'] = '0.3';
$XMLData[] = $cache;
}
#关键词
foreach ($TagsArr as $key => $value) {
$cache = array();
$cache['loc'] = Url::tag($value['tagurl']);
$cache['changefreq'] = 'Weekly';
$cache['priority'] = '0.3';
$XMLData[] = $cache;
}
#分类
foreach ($SortArr as $key => $value) {
$cache = array();
$cache['loc'] = Url::sort($key);
$cache['changefreq'] = 'Weekly';
$cache['priority'] = '0.3';
$XMLData[] = $cache;
}
#输出
$XmlString = '';
#字符串变量收集之后再输出主要是为了适配静态化该xml
$XmlString .= '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL;
$XmlString .= '<?xml-stylesheet type="text/xsl" href="' . BLOG_URL . 'content/templates/J4/Public/Style/sitemap.xsl"?>' . PHP_EOL;
$XmlString .= '<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">' . PHP_EOL;
foreach ($XMLData as $key => $value) {
$XmlString .= '<url>' . PHP_EOL;
$XmlString .= ' <loc>' . $value['loc'] . '</loc>' . PHP_EOL;
if (isset($value['lastmod'])) {
$XmlString .= ' <lastmod>' . $value['lastmod'] . '</lastmod>' . PHP_EOL;