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


PHP Space::rewriteDetail方法代码示例

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


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

示例1: smarty_block_companynews

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2075 $
 */
function smarty_block_companynews($params, $content, &$smarty, &$repeat)
{
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "companynews";
    }
    if (class_exists("Companynews")) {
        $companynews = new Companynewses();
        $companynews_controller = new Companynews();
    } else {
        uses("companynews");
        $companynews = new Companynewses();
        $companynews_controller = new Companynews();
    }
    if (class_exists("Space")) {
        $space_controller = new Space();
    } else {
        uses("space");
        $space_controller = new Space();
    }
    $conditions = array();
    $orderby = array();
    $conditions[] = "cn.status=1";
    if (isset($params['type'])) {
        $type = explode(",", $params['type']);
        $type = array_unique($type);
        foreach ($type as $val) {
            switch ($val) {
                case 'image':
                    $conditions[] = "cn.picture!=''";
                    break;
                case 'hot':
                    $orderby[] = 'clicked DESC';
                default:
                    break;
            }
        }
    }
    if (isset($params['tag'])) {
        $conditions[] = "cn.title like '%" . $params['tag'] . "%'";
    }
    if (!empty($params['companyid'])) {
        $conditions[] = "cn.company_id='" . $params['companyid'] . "'";
    }
    if (!empty($params['memberid'])) {
        $conditions[] = "cn.member_id='" . $params['memberid'] . "'";
    }
    if (isset($params['orderby'])) {
        $orderby[] = trim($params['orderby']);
    } else {
        $orderby[] = "cn.id DESC ";
    }
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    if (isset($_GET['pos'])) {
        $offset = intval($_GET['pos']);
    }
    $companynews->setOrderby($orderby);
    $companynews->setCondition($conditions);
    $companynews->setLimitOffset($offset, $limit);
    $sql = "SELECT cn.id,cn.company_id,cn.title as fulltitle,cn.title,cn.picture,cn.created,cn.content as fullcontent,cn.content,m.username AS userid FROM {$companynews->table_prefix}companynewses cn LEFT JOIN {$companynews->table_prefix}members m ON m.id=cn.member_id " . $companynews->getCondition() . $companynews->getOrderby() . $companynews->getLimitOffset();
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $companynews->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $space_controller->setBaseUrlByUserId($item['userid'], "news");
        $url = $space_controller->rewriteDetail("news", $item['id']);
        $item['url'] = $url;
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        $item['link'] = '<a title="' . strip_tags($item['subject']) . '" href="' . $url . '">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
            }
        }
        $item['thumb'] = $item['src'] = "attachment/" . $item['picture'] . ".small.jpg";
        $smarty->assign($params['name'], $item);
    } else {
        $repeat = false;
        reset($smarty->blockvars[$param_count]);
    }
    if (!is_null($content)) {
//.........这里部分代码省略.........
开发者ID:renduples,项目名称:alibtob,代码行数:101,代码来源:block.companynews.php

示例2: smarty_block_job

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2075 $
 */
function smarty_block_job($params, $content, &$smarty, &$repeat)
{
    $conditions = array();
    $param_count = count($smarty->_tag_stack);
    if (empty($params['name'])) {
        $params['name'] = "job";
    }
    if (class_exists("Jobs")) {
        $job = new Jobs();
    } else {
        uses("job");
        $job = new Jobs();
    }
    if (!class_exists('Space')) {
        uses("space");
    }
    $space_controller = new Space();
    if (isset($params['companyid'])) {
        $conditions[] = "company_id=" . $params['companyid'];
    }
    if (isset($params['status'])) {
        $conditions[] = "j.status='" . $params['status'] . "'";
    }
    if (isset($params['memberid'])) {
        $conditions[] = "member_id=" . $params['memberid'];
    }
    if (isset($params['id'])) {
        $conditions[] = "j.id=" . $params['id'];
    }
    $orderby = null;
    if (isset($params['orderby'])) {
        $orderby = " ORDER BY " . trim($params['orderby']) . " ";
    } else {
        $orderby = " ORDER BY id DESC";
    }
    $job->setCondition($conditions);
    $limit = $offset = 0;
    if (isset($params['row'])) {
        $limit = $params['row'];
    }
    if (isset($params['start'])) {
        $offset = $params['start'];
    }
    $job->setLimitOffset($offset, $limit);
    $sql = "SELECT j.id,j.content,j.name,j.name as title,c.name AS companyname,c.cache_spacename AS userid FROM {$job->table_prefix}jobs j LEFT JOIN {$job->table_prefix}companies c ON c.id=j.company_id " . $job->getCondition() . "{$orderby}" . $job->getLimitOffset();
    if (empty($smarty->blockvars[$param_count])) {
        $smarty->blockvars[$param_count] = $job->GetArray($sql);
        if (!$smarty->blockvars[$param_count]) {
            return $repeat = false;
        }
    }
    if (list($key, $item) = each($smarty->blockvars[$param_count])) {
        $repeat = true;
        $space_controller->setBaseUrlByUserId($item['userid'], "job");
        $url = $space_controller->rewriteDetail("job", $item['id']);
        $item['url'] = $url;
        $item['space_url'] = $space_controller->rewrite($item['userid'], $item['company_id']);
        $item['content'] = strip_tags($item['content']);
        if (isset($params['titlelen'])) {
            $item['title'] = mb_substr(strip_tags($item['title']), 0, $params['titlelen']);
        }
        $item['link'] = '<a title="' . strip_tags($item['name']) . '" href="' . $url . '">' . $item['title'] . '</a>';
        if (isset($params['infolen'])) {
            if (isset($item['content'])) {
                $item['content'] = mb_substr(pb_strip_spaces($item['content']), 0, $params['infolen']);
            }
        }
        $smarty->assign($params['name'], $item);
    } else {
        $repeat = false;
        reset($smarty->blockvars[$param_count]);
    }
    if (!is_null($content)) {
        print $content;
    }
    if (!$repeat) {
        $smarty->blockvars[$param_count] = array();
    }
}
开发者ID:renduples,项目名称:alibtob,代码行数:85,代码来源:block.job.php


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