小智 7
好吧,我正在研究它.
首先,您应该在管理页面中添加新职位.这意味着您应该更改三个文件并在每个文件中添加一些行.
例如,如果要将幻灯片添加到标题中,则应添加新位置
$this->data['text_header'] = $this->language->get('text_header'); // in admin/controller/slideshow.php
Run Code Online (Sandbox Code Playgroud)
////////////////////////////////////////////////
$_['text_header'] = 'Header'; // in admin/language/slideshow.php
Run Code Online (Sandbox Code Playgroud)
////////////////////////////////////////////////
<?php if ($module['position'] == 'header') { ?> // in admin/view/slideshow.tpl
<option value="header" selected="selected"><?php echo $text_header; ?></option>
<?php } else { ?>
<option value="header"><?php echo $text_header; ?></option>
<?php } ?>
Run Code Online (Sandbox Code Playgroud)
然后定义了幻灯片放映的新位置.你可以在管理页面中选择它.
之后,您应该在catalog/view/header.tpl中添加这些代码
<?php foreach ($modules as $module) { ?>
<?php echo $module; ?>
<?php } ?>
Run Code Online (Sandbox Code Playgroud)
然后,在catalog/controller/header.php中,添加一些代码,如content_top.php:$ layout_id = 1;
$module_data = array();
$this->load->model('setting/extension');
$extensions = $this->model_setting_extension->getExtensions('module');
foreach ($extensions as $extension) {
$modules = $this->config->get($extension['code'] . '_module');
if ($modules) {
foreach ($modules as $module) {
if ($module['layout_id'] == $layout_id && $module['position'] == 'header' && $module['status']) {
$module_data[] = array(
'code' => $extension['code'],
'setting' => $module,
'sort_order' => $module['sort_order']
);
}
}
}
}
$sort_order = array();
foreach ($module_data as $key => $value) {
$sort_order[$key] = $value['sort_order'];
}
array_multisort($sort_order, SORT_ASC, $module_data);
$this->data['modules'] = array();
foreach ($module_data as $module) {
$module = $this->getChild('module/' . $module['code'], $module['setting']);
if ($module) {
$this->data['modules'][] = $module;
}
}
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/header.tpl')) {
$this->template = $this->config->get('config_template') . '/template/common/header.tpl';
} else {
$this->template = 'default/template/common/header.tpl';
}
$this->render();
Run Code Online (Sandbox Code Playgroud)
然后全部完成.
此代码的唯一问题是幻灯片显示无法显示为幻灯片,而是显示静态图片或图片.
希望你能解决它并回复我.我的问题帖子: Opencart开发:改变幻灯片的位置
| 归档时间: |
|
| 查看次数: |
17938 次 |
| 最近记录: |