Keyword

Template selection for Latest Items

  • Arturo Guzman
  • Arturo Guzman's Avatar Topic Author
  • Offline
  • New Member
More
14 years 7 months ago #78161 by Arturo Guzman
Template selection for Latest Items was created by Arturo Guzman
When selecting "Latest Items" for a menu type there is no template selection. I just added the parameter to the xml, and it works.BTW... Great job on the template system... I love it.

Please Log in or Create an account to join the conversation.

More
14 years 6 months ago #78162 by gnomeontherun
Replied by gnomeontherun on topic Template selection for Latest Items
I also noticed that the view file for the latest items doesn't have the theme param pulled into it, so it only looks for the default folder in the overrides. So heres what I did to fix that.

Add the theme xml param to the latest.xml in the components/com_k2/views/latest/tmpl/latest.xml file.


Then copied this from itemlists's view.html.php file

//Look for specific K2 theme files
if ($params->get('theme')) {
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.$params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.$params->get('theme'));
}

into the view.html.php file for latest after the other 3 template sets right before parent::display($tpl);.

Please Log in or Create an account to join the conversation.

  • Arturo Guzman
  • Arturo Guzman's Avatar Topic Author
  • Offline
  • New Member
More
14 years 6 months ago #78163 by Arturo Guzman
Replied by Arturo Guzman on topic Template selection for Latest Items
Thanks Jeremy,

I too did that hack, just thought I should post it in the forum, so they add it to the next release, considering, it's very few code to add.

Thank you for posting how to do it, that modification worked for me too.

Jeremy said:I also noticed that the view file for the latest items doesn't have the theme param pulled into it, so it only looks for the default folder in the overrides. So heres what I did to fix that.
Add the theme xml param to the latest.xml in the components/com_k2/views/latest/tmpl/latest.xml file.


Then copied this from itemlists's view.html.php file

//Look for specific K2 theme files
if ($params->get('theme')) {
$this->_addPath('template', JPATH_COMPONENT.DS.'templates'.DS.$params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.'templates'.DS.$params->get('theme'));
$this->_addPath('template', JPATH_SITE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'com_k2'.DS.$params->get('theme'));
}

into the view.html.php file for latest after the other 3 template sets right before parent::display($tpl);.

Please Log in or Create an account to join the conversation.

More
14 years 2 months ago #78164 by Nick Anderson
Replied by Nick Anderson on topic Template selection for Latest Items
Hey guys thanks for the post...I'm pretty new to Joomla and K2, and was able to add in the code at the bottom of your post (for the view.html.php file), but what exactly is the "theme xml param" and where do I grab it? After that, where in the latest.xml file do I put it? I'm using a theme specifically for the k2 portion of my site, and a different theme for the overall rest of the site...I'd want to use the k2 theme (pangea) on my latest items from category page. Thanks in advance for any help.

Nick

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum