where($condition) ->field($field) ->order($order) ->limit($limit) ->cache($cache) ->select(); self::render($list, $imgwidth, $imgheight); return $list; } public static function render(&$list, $imgwidth, $imgheight) { $width = $imgwidth ? 'width="' . $imgwidth . '"' : ''; $height = $imgheight ? 'height="' . $imgheight . '"' : ''; foreach ($list as $k => &$v) { $v['hasimage'] = $v->getData('image') ? true : false; $v['textlink'] = '' . $v['title'] . ''; $v['imglink'] = ''; $v['img'] = ''; } return $list; } public static function getBlockContent($params) { $field = isset($params['id']) ? 'id' : 'name'; $value = isset($params[$field]) ? $params[$field] : ''; $cache = !isset($params['cache']) ? true : (int)$params['cache']; $row = self::where($field, $value) ->cache($cache) ->find(); $result = ''; if ($row) { if ($row['content']) { $result = $row['content']; } else if ($row['image']) { $result = ''; } else { $result = $row['title']; } if ($row['url'] && !$row['content']) { $result = $row['url'] ? '' . $result . '' : $result; } } return $result; } }