I have two different templates on my site, lets just call them Tcat and Titem. My k2 category view page is using Tcat, that is, the menu item of k2 category view page is associated with Tcat. I want the k2 item pages to use Titem, that is, when I click an item link in the category view page, I hope the new page showing this item will be using Titem. However, by default, this new item page will be using Tcat.
I know this is because there is a "itemid=xxx" parameter in the link href.
As far as I know, a k2 item can be open through URL like
mysite.com/index.php?option=com_k2&view=item&id=10, in this case, with no menu item id in the URL, the page will be using the default template; but if
Itemid parameter is added and the URL looks like
http://184.108.40.206/index.php?option=com_k2&view=item&id=10&Itemid=150, then the page will be using the template associated with
#150 menu item. Problem is, since I've associated the category view with
#150 menu item, the links of all items in this category seem to always have this
Itemid parameter, another not so practical way is to associate each item with a menu item that is associated with Titem.... Is there any other way? Maybe by hardcoding some PHP?
Besides, In k2 template php files, the link is generated by something like
<?php echo $this->item->link ?>, I think if I find out how the
$this->item object is conducted, I may find a way to hardcode it. But my PHP knowledge is very limited, upon some researching, I can only get as far as finding out that
$this is an instance of
k2ItemviewList class in
com_k2/views/itemlist/view.html.php, but this class only have one member:
function display($tpl = null), the
$this->item->link, that will help a lot with my learning. Any hint is greatly appreciated. Thanks in advance.