- Posts: 59
COMMUNITY FORUM
How could i insert modules between k2 items
- kire timov
-
Topic Author
- Offline
- Senior Member
Less
More
14 years 6 months ago #90112
by kire timov
How could i insert modules between k2 items was created by kire timov
Hi,On the homepage i like to have modules between the items (in category view). i will attach a picture so you can understand me better..(this is the frontpage)
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
14 years 6 months ago #90113
by Yiota
Replied by Yiota on topic How could i insert modules between k2 items
You will have to write some code to the category.php file of the K2 template.
First step in all the procedure is to create a K2 override, if not already. To create an override of the template files you will have to copy the templates folder from components/com_k2/ and paste it in templates/your template/html/com_k2/.
Next step is to open the category.php file in default folder (or if you are using another template to that one). Go to the foreach that handles the leading or primary or whatever you have set to your parameters for that page and make the following change right after the div class="itemContainerWrapper" closes:
if(($key+1)==3):
if(JModuleHelper::getModules('user1')):
div class="user1"
foreach (JModuleHelper::getModules('user1') as $module) {
echo JModuleHelper::renderModule($module, array('style' => 'YOUR MODULES STYLE'));
}
/div
endif;
endif;
Otherwise you can do it with an easier way than that of the if statement and simply change your parameters a little, use both leading and primary or primary and secondary and just insert the module code between those two containers (itemList and itemListPrimary).
So if your parameters now are Leading Items -> 6 it could be Leading Items -> 3 and Primary Items -> 3
First step in all the procedure is to create a K2 override, if not already. To create an override of the template files you will have to copy the templates folder from components/com_k2/ and paste it in templates/your template/html/com_k2/.
Next step is to open the category.php file in default folder (or if you are using another template to that one). Go to the foreach that handles the leading or primary or whatever you have set to your parameters for that page and make the following change right after the div class="itemContainerWrapper" closes:
if(($key+1)==3):
if(JModuleHelper::getModules('user1')):
div class="user1"
foreach (JModuleHelper::getModules('user1') as $module) {
echo JModuleHelper::renderModule($module, array('style' => 'YOUR MODULES STYLE'));
}
/div
endif;
endif;
Otherwise you can do it with an easier way than that of the if statement and simply change your parameters a little, use both leading and primary or primary and secondary and just insert the module code between those two containers (itemList and itemListPrimary).
So if your parameters now are Leading Items -> 6 it could be Leading Items -> 3 and Primary Items -> 3
Please Log in or Create an account to join the conversation.
- kire timov
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 59
14 years 6 months ago #90114
by kire timov
Replied by kire timov on topic How could i insert modules between k2 items
Thank you very much Yiota! i will try this laterz- if i stuck somewhere i will ask further questions if it's ok - thanks again! ;)
Yiota Ziaggou said:You will have to write some code to the category.php file of the K2 template. First step in all the procedure is to create a K2 override, if not already. To create an override of the template files you will have to copy the templates folder from components/com_k2/ and paste it in templates/your template/html/com_k2/.
Next step is to open the category.php file in default folder (or if you are using another template to that one). Go to the foreach that handles the leading or primary or whatever you have set to your parameters for that page and make the following change right after the div class="itemContainerWrapper" closes:
if(($key+1)==3):
if(JModuleHelper::getModules('user1')):
div class="user1"
foreach (JModuleHelper::getModules('user1') as $module) {
echo JModuleHelper::renderModule($module, array('style' => 'YOUR MODULES STYLE'));
}
/div
endif;
endif;
Otherwise you can do it with an easier way than that of the if statement and simply change your parameters a little, use both leading and primary or primary and secondary and just insert the module code between those two containers (itemList and itemListPrimary).
So if your parameters now are Leading Items -> 6 it could be Leading Items -> 3 and Primary Items -> 3
Yiota Ziaggou said:You will have to write some code to the category.php file of the K2 template. First step in all the procedure is to create a K2 override, if not already. To create an override of the template files you will have to copy the templates folder from components/com_k2/ and paste it in templates/your template/html/com_k2/.
Next step is to open the category.php file in default folder (or if you are using another template to that one). Go to the foreach that handles the leading or primary or whatever you have set to your parameters for that page and make the following change right after the div class="itemContainerWrapper" closes:
if(($key+1)==3):
if(JModuleHelper::getModules('user1')):
div class="user1"
foreach (JModuleHelper::getModules('user1') as $module) {
echo JModuleHelper::renderModule($module, array('style' => 'YOUR MODULES STYLE'));
}
/div
endif;
endif;
Otherwise you can do it with an easier way than that of the if statement and simply change your parameters a little, use both leading and primary or primary and secondary and just insert the module code between those two containers (itemList and itemListPrimary).
So if your parameters now are Leading Items -> 6 it could be Leading Items -> 3 and Primary Items -> 3
Please Log in or Create an account to join the conversation.
- kire timov
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 59
14 years 6 months ago #90115
by kire timov
Replied by kire timov on topic How could i insert modules between k2 items
i am not a programmer but looking at this if(($key+1)==3): says that after the third item the module is inserted right? so if i cahnge this to if(($key+1)==6): than after the sixth item the module will appear? sorry for my newbines .. just using logic without previous php knowledge.
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
14 years 6 months ago #90116
by Yiota
Replied by Yiota on topic How could i insert modules between k2 items
Yes, that is correct.
Please Log in or Create an account to join the conversation.
- kire timov
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 59
14 years 6 months ago #90117
by kire timov
Replied by kire timov on topic How could i insert modules between k2 items
and this if(JModuleHelper::getModules('user1')): if there is a module in that positon says to pull the module/s that are in user1... so if i create new module position in the joomla xml named test1 than i want to use the module that is loaded in the module position test i should do this
if(JModuleHelper::getModules('test1')):
div class="user1"
foreach (JModuleHelper::getModules('test1') as $module)
and the module that is loaded in test1 will appear in k2?
Now here
echo JModuleHelper::renderModule($module, array('style' => 'YOUR MODULES STYLE'));
echo JModuleHelper::renderModule($module, array('style' => here i insert the height and width of the module position?')); ... if this is correct than what if i want this to be controlled with the module (some modules have parametars where you can enter width and height)
Sorry if i am bothering you i just really want to learn php on the way as much as i can ^^
if(JModuleHelper::getModules('test1')):
div class="user1"
foreach (JModuleHelper::getModules('test1') as $module)
and the module that is loaded in test1 will appear in k2?
Now here
echo JModuleHelper::renderModule($module, array('style' => 'YOUR MODULES STYLE'));
echo JModuleHelper::renderModule($module, array('style' => here i insert the height and width of the module position?')); ... if this is correct than what if i want this to be controlled with the module (some modules have parametars where you can enter width and height)
Sorry if i am bothering you i just really want to learn php on the way as much as i can ^^
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
14 years 6 months ago #90118
by Yiota
Replied by Yiota on topic How could i insert modules between k2 items
For the module position you are correct. The user1 is a module position which calls a module that is published in it. The module style is the same you are using in your template's index.php when you call up your module positions. Like jdoc:include type="modules" name="user1" style="????". It has to do with the module style, not the module parameters.
Please Log in or Create an account to join the conversation.
- kire timov
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 59
14 years 6 months ago #90119
by kire timov
Replied by kire timov on topic How could i insert modules between k2 items
this confuses me a little
I am in ROOT/templates/my_template/index.php
in that file only this exists
if (class_exists('T3Template')) {
$tmpl = T3Template::getInstance($this);
$tmpl->render();
return;
} else {
//Need to install or enable JAT3 Plugin
echo JText::_('Missing jat3 framework plugin');
}
I am in ROOT/templates/my_template/index.php
in that file only this exists
if (class_exists('T3Template')) {
$tmpl = T3Template::getInstance($this);
$tmpl->render();
return;
} else {
//Need to install or enable JAT3 Plugin
echo JText::_('Missing jat3 framework plugin');
}
Please Log in or Create an account to join the conversation.
- Yiota
-
- Visitor
14 years 6 months ago #90120
by Yiota
Replied by Yiota on topic How could i insert modules between k2 items
I don't know your template's structure to help you with that, but you can search in your template for this statement jdoc:include type="modules" name="user1" style="????". It could be in another file.
Please Log in or Create an account to join the conversation.
- kire timov
-
Topic Author
- Offline
- Senior Member
Less
More
- Posts: 59
14 years 6 months ago #90121
by kire timov
Replied by kire timov on topic How could i insert modules between k2 items
I searched all .php files in my template folder with "
in My_Template/blocks/navhelper.
edit: i hate when i cant put code in this text editor
I do not want to waste your time so thank you for assisting me. I will try to find an answer for this.. when i will ill try to put everything as you instructed me and notify you if i am stuck again somwhere :)
Yiota Ziaggou said:I don't know your template's structure to help you with that, but you can search in your template for this statement jdoc:include type="modules" name="user1" style="????". It could be in another file.
in My_Template/blocks/navhelper.
edit: i hate when i cant put code in this text editor
I do not want to waste your time so thank you for assisting me. I will try to find an answer for this.. when i will ill try to put everything as you instructed me and notify you if i am stuck again somwhere :)
Yiota Ziaggou said:I don't know your template's structure to help you with that, but you can search in your template for this statement jdoc:include type="modules" name="user1" style="????". It could be in another file.
Please Log in or Create an account to join the conversation.