For some reasons, some modules need to add extra links by website owners. This is a tutorial which teach you how to add links.
因为各类缘由,一些模块或者网站使用者想为本身的网站添加一些自定义连接。本教程教您如何去作。
举例来说,若是您购买了【常见问题及解答(FAQs)】插件,则您须要本身决定将该连接加到什么地方,好比加到菜单部分,加到网站的地方等等。假设您想将该连接(http://www.yourdomain.com/index.php?route=coc/faq)加到网站顶部菜单部分,则按照以下步骤进行(假设您使用的是默认的mycncart模版):
第一步, 为各个语言版本添加自定义变量,下面以英文语言文件为例:
编辑文件 catalog/language/english/common/header.php
添加以下代码:
php
$_[‘text_faq’] = ‘FAQs';
web
复制代码dom
第二步. 编辑控制器文件 catalog/controller/common/header.php
在相关地方添加以下两行代码:
网站
$data[‘text_faq’] = $this->language->get(‘text_faq’);
this
$this->data[‘faq’] = $this->url->link(‘coc/faq’);
url
复制代码spa
第三步. 编辑模版文件 catalog/view/theme/yourtheme/template/common/header.tpl
在菜单部分添加以下连接:
插件
<li><a href=”<?php echo $faq; ?>”><?php echo $text_faq; ?></a></li>教程
复制代码get