1 回答

TA貢獻(xiàn)1921條經(jīng)驗(yàn) 獲得超9個(gè)贊
例如,拉特說(shuō)我們需要在精選模塊中添加圖像。
轉(zhuǎn)到/admin/view/template/extension/module/featured.php
幾乎在 內(nèi)部的任何位置public function index() { ... }(可能在之后$this->load->model('setting/module');和之前$this->response->setOutput($this->load->view('extension/module/featured', $data));)添加以下內(nèi)容。
我之前已經(jīng)添加過(guò)if (isset($this->request->post['top'])) {
if (isset($this->request->post['image'])) {
$data['image'] = $this->request->post['image'];
} elseif (!empty($module_info)) {
$data['image'] = $module_info['image'];
} else {
$data['image'] = '';
}
$this->load->model('tool/image');
if (isset($this->request->post['image']) && is_file(DIR_IMAGE . $this->request->post['image'])) {
$data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 100, 100);
} elseif (!empty($module_info) && is_file(DIR_IMAGE . $module_info['image'])) {
$data['thumb'] = $this->model_tool_image->resize($module_info['image'], 100, 100);
} else {
$data['thumb'] = $this->model_tool_image->resize('no_image.png', 100, 100);
}
$data['placeholder'] = $this->model_tool_image->resize('no_image.png', 100, 100);
比,在/admin/view/template/extension/module/featured.twig中找到
<div class="form-group">
<label class="col-sm-2 control-label" for="input-name">{{ entry_name }}</label>
<div class="col-sm-10">
<input type="text" name="name" value="{{ name }}" placeholder="{{ entry_name }}" id="input-name" class="form-control" />
{% if error_name %}
<div class="text-danger">{{ error_name }}</div>
{% endif %}
</div>
</div>
并在后面添加
<div class="form-group">
<label class="col-sm-2 control-label">{{ entry_image }}</label>
<div class="col-sm-10"><a href="" id="thumb-image" data-toggle="image" class="img-thumbnail"><img src="{{ thumb }}" alt="" title="" data-placeholder="{{ placeholder }}" /></a>
<input type="hidden" name="image" value="{{ image }}" id="input-image" />
</div>
</div>
現(xiàn)在應(yīng)該可以了。
- 1 回答
- 0 關(guān)注
- 96 瀏覽
添加回答
舉報(bào)