Keyword

Using module positions inside of sub-templates

More
12 years 2 weeks ago #103522 by Mee
I have a quick question connected with my little knowledge of Joomla\K2. I'm using subtemplates to create different layouts for different pages. When I declare module position on sub template:
<jdoc:include type="modules" name="position-7" />

Nothing happens. I've tried the same code for main template file and it worked, but seems like it's not parsed for sub-templates. Am I right? How can I include modules into sub-templates then?

thanks in advance,
Michael

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

More
12 years 2 weeks ago #103523 by william white

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

More
12 years 2 weeks ago #103524 by Mee
Unfortunately it requires PHP 5.3, which is not supported by my hosting, but thanks for advice.

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

More
12 years 2 weeks ago #103525 by Mee
Ok, just in case if someone will search for answer, here is a solution I was given at Stackoverflow:

doc tag only works in joomla core template. If you want to load modules of specific position in your k2 subtemplate write the following code at your desired location in that subtemplate.

$module = JModuleHelper::getModules('xxxx');
// xxxx is any virtual position, no need to create it anywhere.
echo JModuleHelper::renderModule($module[0]);
replace xxxx with your desired position name.



(stackoverflow.com/questions/12531036/using-modules-in-joomla-k2-sub-templates)

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

More
11 years 11 months ago #103526 by Cameron

Mee wrote: Ok, just in case if someone will search for answer, here is a solution I was given at Stackoverflow:

doc tag only works in joomla core template. If you want to load modules of specific position in your k2 subtemplate write the following code at your desired location in that subtemplate.

$module = JModuleHelper::getModules('xxxx');
// xxxx is any virtual position, no need to create it anywhere.
echo JModuleHelper::renderModule($module[0]);
replace xxxx with your desired position name.



(stackoverflow.com/questions/12531036/using-modules-in-joomla-k2-sub-templates)


This worked a treat, but I've been trying to figure out how to use my template module styling with it. I've tried a few things and obviously copy code from the template.php file isn't working. I've tried code I found http://www.gavick.com/forums/general-discussion/gk-module-position-in-a-k2-template-12214.html on the Gavick forum but it screws up the page.

I could hardcode the styling but I thought I'd try and learn something in the process to keep the flexibility.

I'm using a Yootheme template.

It seems how the code in the template.php file pulls the styling from Joomla doesn't work inside K2.

Any help or leading to the right direction would be appreciated.

I've been working on this for a few days and finally got to the point where I thought I'd ask :)

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


Powered by Kunena Forum