OpenCart. How to 添加 a 新 content 页面 和 link it to a 新 menu 选项卡 (based on 引导 templates)
2014年3月26日
This tutorial is going to show how to 添加 a 新 content 页面 和 link it to a 新 menu 选项卡.
OpenCart. How to 添加 a 新 content 页面 和 link it to a 新 menu 选项卡 (based on 引导 templates)
-
Log into your OpenCart administration panel (yoursite.com/admin).
-
导航到 Catalog -> Information.
-
单击 插入 按钮添加新的content页.
-
Type in the name of your 页面 和 insert the 页面 text to the 描述 场. 你可以使用视觉效果 编辑器 格式化你的文本. 插入 images 和 create hyperlinks. 你也可以编辑 HTML code. 只要点击 Source button.
-
选择 Data 选项卡. Here you can define 页面 keywords, set Sort Order, the bottom footer display 和 enable or disable the 页面.
-
Save the changes 和 check your store online. Content 页面s are being displayed in the 信息块.
-
我们需要编辑的代码 header.tpl file in order to 添加 our content 页面 to the top menu. 文件位于 /catalog/view/theme/themeXXX/template/common 文件夹.
-
使用任何PHP/代码编辑该文件 编辑器. 搜索菜单代码. It should look similar to the following:
-
request->get['route'])) { $route='active'; } else {$route='';}?>
- " href="">
- " href="" id="wishlist-total">
- " href="http://suva.extreme-sys.com/">
- " href="http://re.extreme-sys.com/">
- " href="">
注意: The code may vary depending on the template.
-
Each line of code displays one menu element. 复制最后一行代码:
- " href="">
-
We need to change the condition of assigning “active” CSS class for our 新 menu item. 让我们替换:
request->get['route']) && $this->request->get['route']=="结帐/结帐") {echo "active";} ?>
:
request->get['route']) && $this->request->get['route']=="information/information") && (isset($this->request->get['information_id']) && $this->request->get['information_id']=="13")) {echo "active";} ?>
这是 the code for the Information 页面. 你应该换掉 13 与您的新页面的ID.
以下代码:
should be changed to the title of the menu element. 这是 测试 在我们的例子中.
注意: is the code for the 字体太棒了 图标. You may replace the class with the one you like. You can find the list of 图标s 和 their classes by going to the following link . The version of Font 图标s can be checked in the /catalog/view/theme/themeXXX/样式表/ font-awesome.模板的CSS文件.
-
We need to get the URL to our content 页面 to link it to the top menu. Click on the 页面 link in the 信息块 和 copy the URL from the 添加ress bar of your web 浏览器.
然后更改以下代码:
to the URL to our content 页面 we have copied.
-
Here is the complete line with the changes we have applied:
- request->get['information_id']) && $this->request->get['information_id']=="13")) {echo "active";} ?>" href="http://templatetesting.com/vincent/index.php?route=information/information&information_id=13">测试
-
And the complete menu code block will look like this:
-
request->get['route'])) { $route='active'; } else {$route='';}?>
- " href="">
- " href="" id="wishlist-total">
- " href="http://suva.extreme-sys.com/">
- " href="http://re.extreme-sys.com/">
- " href="">
- request->get['information_id']) && $this->request->get['information_id']=="13")) {echo "active";} ?>" href="http://templatetesting.com/vincent/index.php?route=information/information&information_id=13">测试
-
保存文件. 页面已添加到 header menu.
-
Now let’s 添加 the link to our 新 页面 to the mobile view menu. 我们可以检查一下 火狐 浏览器: Web developer->Responsive design view 菜单(Ctrl + Shift + M).
-
In the same file, we need to find the code
Add a 新 line 和 paste the code you have copied.
别忘了更换 13 with the actual ID of your 新 页面.