本文整理汇总了PHP中Attachments::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachments::getUrl方法的具体用法?PHP Attachments::getUrl怎么用?PHP Attachments::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachments
的用法示例。
在下文中一共展示了Attachments::getUrl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
if ($this->mySelf == 'yes') {
$sql = "SELECT id,title,faceimg,uid,colid,cTime,updateTime FROM {{posts}} WHERE (uid='{$this->uid}' OR uid IN(SELECT logid FROM {{favorites}} WHERE uid='{$this->uid}' AND classify='user')) AND classify='" . Posts::CLASSIFY_WEDDING . "' ORDER BY cTime DESC";
} else {
$sql = "SELECT id,title,faceimg,uid,colid,cTime,updateTime FROM {{posts}} WHERE uid='{$this->uid}' AND classify='" . Posts::CLASSIFY_WEDDING . "' ORDER BY cTime DESC";
}
Posts::getAll(array('sql' => $sql), $pages, $lists);
if (!empty($lists)) {
foreach ($lists as $k => $p) {
if ($p['faceimg'] > 0) {
$_attach = Attachments::getOne($p['faceimg']);
$_url = Attachments::getUrl($_attach);
$lists[$k]['faceimg'] = $_url;
} else {
$lists[$k]['faceimg'] = '';
}
}
}
if ($this->mySelf != 'yes') {
Posts::updateCount($this->uid, 'Users');
}
$data = array('posts' => $lists, 'pages' => $pages);
$this->pageTitle = $this->userInfo['truename'] . '的主页 - ' . zmf::config('sitename');
$this->render('index', $data);
}
示例2: actionIndex
public function actionIndex()
{
$criteria = new CDbCriteria();
$criteria->order = 'cTime DESC';
$count = Attachments::model()->count($criteria);
$pager = new CPagination($count);
$pager->pageSize = 30;
$pager->applyLimit($criteria);
$posts = Attachments::model()->findAll($criteria);
foreach ($posts as $k => $val) {
$_img = Attachments::getUrl($val, 240);
$posts[$k]['filePath'] = $_img;
}
$this->render('index', array('pages' => $pager, 'posts' => $posts));
}
示例3: actionView
public function actionView($id)
{
$this->layout = '/layouts/group';
$this->currentModule = 'group';
$info = WeddingGroup::model()->findByPk($id);
if (!$info) {
throw new CHttpException(404, '你所查看的页面不存在');
}
$info->avatar = $info->getAvatar($info->avatar);
if (zmf::uid()) {
$reInfo = GroupLink::findRelation($this->uid, $id);
if ($reInfo) {
$this->joined = true;
}
}
//获取团队成员
$criteria = new CDbCriteria(array('condition' => 'gl.groupid=' . $id, 'join' => 'LEFT JOIN {{group_link}} gl ON t.id=gl.uid', 'select' => 't.id,t.truename,t.avatar'));
$members = new CActiveDataProvider('Users', array('pagination' => array('pageSize' => 10), 'criteria' => $criteria));
//获取团队案例列表
$sql = "SELECT p.id,p.title,p.faceimg,p.uid,p.colid,p.cTime,p.updateTime FROM {{posts}} p WHERE p.groupid='{$id}' AND p.classify=" . Posts::CLASSIFY_WEDDING . " AND p.status=" . Posts::STATUS_PASSED . " ORDER BY p.cTime DESC";
Posts::getAll(array('sql' => $sql), $pages, $posts);
if (!empty($posts)) {
foreach ($posts as $k => $p) {
if ($p['faceimg'] > 0) {
$_attach = Attachments::getOne($p['faceimg']);
$_url = Attachments::getUrl($_attach);
$posts[$k]['faceimg'] = $_url;
} else {
$posts[$k]['faceimg'] = '';
}
}
}
$data = array('info' => $info, 'posts' => $posts, 'pages' => $pages);
$this->pageTitle = $info['title'] . ' - ' . zmf::config('sitename');
$this->render('view', $data);
}
示例4: actionView
public function actionView($id)
{
$keyid = zmf::filterInput($id);
$checkInfo = Posts::checkInfo($info, $keyid, 'posts');
if (!$checkInfo['status']) {
$this->message(0, $checkInfo['msg']);
}
if ($info['redirect'] != '') {
$this->redirect(zmf::config('domain') . $info['redirect'], true, 301);
}
if ($info['classify'] == Posts::CLASSIFY_BLOG) {
$this->redirect(zmf::config('blog_domain') . '/post/' . $keyid . '.html', true, 301);
}
$groupInfo = array();
if ($info['groupid'] > 0) {
$groupInfo = WeddingGroup::getOne($info['groupid']);
if ($groupInfo['status'] != Posts::STATUS_PASSED) {
$this->message(0, '该团队已不存在');
}
$groupInfo['avatar'] = Users::getAvatar($groupInfo['avatar']);
}
$keyid = $info['id'];
$this->currentColid = $info['colid'];
$colinfo = Column::getSimpleInfo($info['colid']);
$breads[] = CHtml::link('作品', array('posts/index'));
if ($colinfo) {
$breads[] = CHtml::link($colinfo['title'], array('posts/index', 'colid' => $colinfo['id']));
}
//更新统计
Posts::updateCount($keyid, 'Posts');
//获取用户推荐文章
$sqlUser = "SELECT id,title,faceimg,uid,colid,cTime,updateTime FROM {{posts}} WHERE id!='{$id}' AND uid='{$info['uid']}' AND classify=" . Posts::CLASSIFY_WEDDING . " ORDER BY hits DESC LIMIT 5";
$userPosts = Yii::app()->db->createCommand($sqlUser)->queryAll();
//获取标签
$info['tagids'] = join(',', explode(',', $info['tagids']));
$relPosts = array();
if ($info['tagids'] != '') {
//获取与本文类似文章
//计算方法为与本文提到的标签相关文章出现次数最多的
$relPosts = Posts::getTopPostsByTags($id, $info['tagids']);
$_sql = "SELECT id,title FROM {{tags}} WHERE classify='posts' AND id IN({$info['tagids']})";
$info['tagids'] = Yii::app()->db->createCommand($_sql)->queryAll();
}
if (!empty($userPosts)) {
foreach ($userPosts as $k => $p) {
if ($p['faceimg'] > 0) {
$_attach = Attachments::getOne($p['faceimg']);
$_url = Attachments::getUrl($_attach);
$userPosts[$k]['faceimg'] = $_url;
} else {
$userPosts[$k]['faceimg'] = '';
}
}
}
if (!empty($relPosts)) {
foreach ($relPosts as $k => $p) {
if ($p['faceimg'] > 0) {
$_attach = Attachments::getOne($p['faceimg']);
$_url = Attachments::getUrl($_attach);
$relPosts[$k]['faceimg'] = $_url;
} else {
$relPosts[$k]['faceimg'] = '';
}
}
}
//判断是否已收藏和赞过
if (!Yii::app()->user->isGuest) {
if (Favorites::checkFavored($keyid, 'posts')) {
$this->favorited = true;
}
if (UserAction::checkAction($keyid, 'favorPost')) {
$this->favored = true;
}
}
$breads[] = $info['title'];
$data = array('colinfo' => $colinfo, 'data' => $info, 'breads' => $breads, 'userPosts' => $userPosts, 'relPosts' => $relPosts, 'groupInfo' => $groupInfo);
$this->pageTitle = (!empty($colinfo) ? "【{$colinfo['title']}】" : '') . $info['title'] . ' - ' . zmf::config('sitename');
$this->render('view', $data);
}
示例5: foreachNaodong
private function foreachNaodong($posts)
{
if (!empty($posts)) {
$uids = array_keys(CHtml::listData($posts, 'uid', ''));
$usersInfo = array();
if (!empty($uids)) {
$uidstr = join(',', $uids);
$items = Users::model()->findAll(array('condition' => "id IN({$uidstr}) AND status=" . Posts::STATUS_PASSED, 'select' => "id,truename"));
$usersInfo = CHtml::listData($items, 'id', 'truename');
}
$imgsize = 600;
if ($this->isMobile == 'yes') {
$imgsize = 170;
}
foreach ($posts as $k => $v) {
if ($v['attachid'] > 0) {
$_attach = Attachments::model()->findByPk($v['attachid']);
$_url = Attachments::getUrl($_attach, $imgsize);
$posts[$k]['attachid'] = $_url;
} else {
$posts[$k]['attachid'] = '';
}
$posts[$k]['truename'] = $usersInfo[$v['uid']];
}
}
return $posts;
}