当前位置: 首页>>代码示例>>PHP>>正文


PHP model::FieldValue方法代码示例

本文整理汇总了PHP中model::FieldValue方法的典型用法代码示例。如果您正苦于以下问题:PHP model::FieldValue方法的具体用法?PHP model::FieldValue怎么用?PHP model::FieldValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model的用法示例。


在下文中一共展示了model::FieldValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: content

 function content($id, $mId, $table = NULL, $tpl = true)
 {
     $model = $this->getCache('system/models.cache', $mId);
     empty($table) && ($table = $model['tbn']);
     $rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__{$table}` WHERE id='" . (int) $id . "' AND `status` ='1'");
     empty($rs) && $this->error('error:page');
     $F = $this->getCache('system/forum.cache', $rs->fid);
     if ($F['status'] == 0) {
         return false;
     }
     if ($rs->url) {
         if ($this->mode == "CreateHtml") {
             return false;
         } else {
             $this->go($rs->url);
         }
     }
     if ($this->mode == "CreateHtml" && (strstr($F['contentRule'], '{PHP}') || $F['url'] || $F['mode'] == 0)) {
         return false;
     }
     $_iurlArray = array((array) $rs, $F, $model);
     $rs->iurl = $this->iurl('content', $_iurlArray, $page);
     $rs->url = $rs->iurl->href;
     $tpl && $this->gotohtml($rs->iurl->path, $rs->iurl->href, $F['mode']);
     $this->iList($rs->fid, false);
     $rs->comment = array('url' => $this->config['publicURL'] . "/comment.php?indexId={$rs->id}&mId={$mId}&sortId={$rs->fid}", 'count' => $rs->comments);
     if ($F['mode']) {
         $rs->hits = "<script type=\"text/javascript\" src=\"" . $this->config['publicURL'] . "/action.php?do=hits&mid={$mId}&fid={$rs->fid}&id={$rs->id}&action=show\" language=\"javascript\"></script>";
         $rs->digg = "<script type=\"text/javascript\" src=\"" . $this->config['publicURL'] . "/action.php?do=digg&mid={$mId}&id={$rs->id}&action=show\" language=\"javascript\"></script>";
         $rs->comments = "<script type=\"text/javascript\" src=\"" . $this->config['publicURL'] . "/action.php?do=comment&mid={$mId}&id={$rs->id}&action=show\" language=\"javascript\"></script>";
     } else {
         $this->mode != 'CreateHtml' && iCMS_DB::query("UPDATE `#iCMS@__{$table}` SET hits=hits+1 WHERE `id` ='{$rs->id}' LIMIT 1");
     }
     if ($rs->tags) {
         $tagarray = explode(',', $rs->tags);
         foreach ($tagarray as $tk => $tag) {
             $t = $this->getTag($tag);
             if ($t) {
                 $rs->tag[$tk]['name'] = $tag;
                 $rs->tag[$tk]['url'] = $t['url']->href;
                 $rs->taglink .= '<a href="' . $rs->tag[$tk]['url'] . '" class="tag" target="_self" title="' . $t['count'] . $this->language('page:list') . '">' . $rs->tag[$tk]['name'] . '</a> ';
             }
         }
     }
     if ($fArray = explode(',', $model['field'])) {
         include_once iPATH . 'include/model.class.php';
         foreach ($fArray as $k => $field) {
             if (!model::isDefField($field)) {
                 $FV = model::FieldValue($mId, $field, $rs->{$field});
                 $FV !== Null && ($rs->{$field} = $FV);
             }
         }
     }
     $rs->prev = $this->language('show:first');
     $prers = iCMS_DB::getRow("SELECT * FROM `#iCMS@__{$table}` WHERE `id` < '{$rs->id}' AND `fid`='{$rs->fid}' AND `status`='1' order by id DESC Limit 1");
     $prers && ($rs->prev = '<a href="' . $this->iurl('content', array((array) $prers, $F, $model))->href . '" class="prev" target="_self">' . $prers->title . '</a>');
     $rs->next = $this->language('show:last');
     $nextrs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__{$table}` WHERE `id` > '{$rs->id}'  and `fid`='{$rs->fid}' AND `status`='1' order by id ASC Limit 1");
     $nextrs && ($rs->next = '<a href="' . $this->iurl('content', array((array) $nextrs, $F, $model))->href . '" class="next" target="_self">' . $nextrs->title . '</a>');
     $rs->link = "<a href='{$rs->url}'>{$rs->title}</a>";
     $rs->mid = $mId;
     $rs->table = $table;
     $this->Hook($rs);
     $this->assign('content', (array) $rs);
     if ($tpl) {
         $tpl = empty($rs->tpl) ? $F['contentTPL'] : $rs->tpl;
         return $this->iPrint($tpl, 'content');
     }
 }
开发者ID:idreamsoft,项目名称:iCMS5.1,代码行数:69,代码来源:iCMS.class.php

示例2: iCMS_contents


//.........这里部分代码省略.........
        $day = empty($iCMS->date['d']) ? '01' : $iCMS->date['d'];
        $start = strtotime($iCMS->date['y'] . $iCMS->date['m'] . $day);
        $end = empty($iCMS->date['d']) ? $start + 86400 * $iCMS->date['total'] : $start + 86400;
        $whereSQL .= " AND `pubdate`<='{$end}' AND `pubdate`>='{$start}'";
    } else {
        isset($vars['startdate']) && ($whereSQL .= " AND `pubdate`>='" . strtotime($vars['startdate']) . "'");
        isset($vars['enddate']) && ($whereSQL .= " AND `pubdate`<='" . strtotime($vars['enddate']) . "'");
    }
    isset($vars['where']) && ($whereSQL .= $vars['where']);
    if ($vars['action'] == 'search') {
        $whereSQL .= $iCMS->actionSQL;
    } elseif ($vars['action'] == 'tag') {
        if (empty($vars['tag'])) {
            return false;
        }
        if (is_array($vars['tag'])) {
            $_tCache = $vars['tag'];
        } else {
            $_tCache = $iCMS->getCache($iCMS->getTagKey($vars['tag']));
        }
        if ($_tCache['id']) {
            $tidSQL = 'AND `tid`=\'' . $_tCache['id'] . '\'';
        } else {
            if ($_tCache) {
                foreach ($_tCache as $_tag) {
                    if ($_tag) {
                        $_tids[] = $_tag['id'];
                    }
                }
            }
            if (empty($_tids)) {
                return false;
            }
            $tidSQL = 'AND `tid` in (' . implode(',', $_tids) . ')';
        }
        $countSQL = 'SELECT count(#iCMS@__' . $table . '.id) FROM `#iCMS@__' . $table . '`,`#iCMS@__taglist` WHERE #iCMS@__' . $table . '.id = `indexId` ' . $tidSQL . ' AND  #iCMS@__taglist.modelId=' . $mId . ' AND';
        $selectSQL = 'SELECT #iCMS@__' . $table . '.* FROM `#iCMS@__' . $table . '`,`#iCMS@__taglist` WHERE #iCMS@__' . $table . '.id = `indexId` ' . $tidSQL . ' AND #iCMS@__taglist.modelId=' . $mId . ' AND';
        $orderSQL = " ORDER BY #iCMS@__taglist.indexId {$by}";
        $vars['indexId!'] && ($whereSQL .= getSQL($vars['indexId!'], '#iCMS@__' . $table . '.id', 'not'));
    }
    $offset = 0;
    if ($vars['page']) {
        empty($countSQL) && ($countSQL = "SELECT count(*) FROM `#iCMS@__{$table}` WHERE");
        $total = iCMS_DB::getValue($countSQL . " {$whereSQL}");
        //        echo iCMS_DB::last_query;
        $pagenav = isset($vars['pagenav']) ? $vars['pagenav'] : "pagenav";
        $pnstyle = isset($vars['pnstyle']) ? $vars['pnstyle'] : 0;
        $offset = $iCMS->multi(array('total' => $total, 'perpage' => $maxperpage, 'unit' => $iCMS->language('page:list'), 'nowindex' => $GLOBALS['page'], 'pagenav' => $pagenav, 'pnstyle' => $pnstyle));
        //        $GLOBALS['cpn'] && $iCMS->_vars['pagenav'].='<span><a class="page_more" href="more.php?fid='.$ids.'" target="_self">'.$iCMS->language('page:more').'</a></span>';
        //$iCMS->addto($pagenav,"----------------");
    }
    $iscache = true;
    if ($vars['cache'] == false || isset($vars['page'])) {
        $iscache = false;
        $rs = array();
    } else {
        $cacheName = 'clist/' . md5($whereSQL . $orderSQL . $maxperpage);
        $rs = $iCMS->getCache($cacheName);
    }
    if (empty($rs)) {
        empty($selectSQL) && ($selectSQL = "SELECT * FROM `#iCMS@__{$table}` WHERE");
        $rs = iCMS_DB::getArray($selectSQL . " {$whereSQL} {$orderSQL} LIMIT {$offset} , {$maxperpage}");
        //echo iCMS_DB::$last_query;
        //iCMS_DB::$last_query='explain '.iCMS_DB::$last_query;
        //$explain=iCMS_DB::getRow(iCMS_DB::$last_query);
        //print_r($explain);
        $_count = count($rs);
        for ($i = 0; $i < $_count; $i++) {
            $F = $forum[$rs[$i]['fid']];
            $rs[$i]['sort']['name'] = $F['name'];
            $rs[$i]['sort']['url'] = $iCMS->iurl('forum', $F)->href;
            $rs[$i]['sort']['link'] = "<a href='{$rs[$i]['sort']['url']}'>{$rs[$i]['sort']['name']}</a>";
            $rs[$i]['url'] = $iCMS->iurl('content', array($rs[$i], $F, $model))->href;
            $rs[$i]['commentUrl'] = $iCMS->config['publicURL'] . "/comment.php?indexId=" . $rs[$i]['id'] . "&mId=" . $mId . "&sortId=" . $rs[$i]['fid'];
            $rs[$i]['link'] = "<a href='{$rs[$i]['url']}'>{$rs[$i]['title']}</a>";
            if ($rs[$i]['tags'] && isset($vars['tag'])) {
                $tagarray = explode(',', $rs[$i]['tags']);
                foreach ($tagarray as $tk => $tag) {
                    $t = $iCMS->getTag($tag);
                    if ($t) {
                        $rs[$i]['tag'][$tk]['name'] = $tag;
                        $rs[$i]['tag'][$tk]['url'] = $t['url']->href;
                        $rs[$i]['taglink'] .= '<a href="' . $rs[$i]['tag'][$tk]['url'] . '" class="tag" target="_self">' . $tag . '</a> ';
                    }
                }
            }
            if ($fArray = explode(',', $model['field'])) {
                foreach ($fArray as $k => $field) {
                    if (!model::isDefField($field)) {
                        $FV = model::FieldValue($mId, $field, $rs[$i][$field]);
                        $FV !== Null && ($rs[$i][$field] = $FV);
                    }
                }
            }
        }
        $iscache && $iCMS->SetCache($cacheName, $rs, $cacheTime);
    }
    //	var_dump($rs);
    return $rs;
}
开发者ID:idreamsoft,项目名称:iCMS5.1,代码行数:101,代码来源:iCMS.contents.php


注:本文中的model::FieldValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。