如何获取当前类别ID-OpenCart [英] How to get current category id - OpenCart
本文介绍了如何获取当前类别ID-OpenCart的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想添加到标题中-if语句:
I want to add to in header - if statement:
<?php if (category = 17) { ?>
<meta name="description" content="category 17 description" />
<?php } ?>
<?php if (category = 18) { ?>
<meta name="description" content="category 18 description" />
<?php } ?>
如何获取当前类别ID
How can i get current category id
推荐答案
将此代码放在标题中的代码之前
Put this before the code in your header
$category = empty($this->request->get['path']) ? 0 : (int) array_pop(explode('_', $this->request->get['path']));
然后使用$category
代替问题中的category
Then use $category
instead of just category
as you have in your question
这篇关于如何获取当前类别ID-OpenCart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文