automatically override template for a list of articles under a specific category?

automatically override template for a list of articles under a specific category?

{field 1}{loadmodule mod_k2_comments,K2 Comments} 

I had similar problem and I achieved desired results by slightly altering one workaround already mentioned here.

In /my_template/html/com_content/article/ I have files default.phpdefault_default.php and default_altered.php. The default.php only decides which one of the other files loads. I tested two ways to do it.

Based on category id:

if ($this->item->catid==19) {
  echo $this->loadTemplate('altered');
} else {
  echo $this->loadTemplate('default');
}

Or based on active menu item id:

$menuid = JFactory::getApplication()->getMenu()->getActive()->id;
if ($menuid==107) {
  echo $this->loadTemplate('altered');
} else {
  echo $this->loadTemplate('default');
}