Keyword
Please note that official support for commercial extensions & templates is provided in the Subscriber Help Desk.
Support requests should ONLY be directed there and require an active subscription plan.
This forum board is to be used for archive purposes and knowledge exchange ONLY.

Inserting modules into item

  • BARBARA GERANAKI
  • BARBARA GERANAKI's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 4 months ago #137449 by BARBARA GERANAKI
Inserting modules into item was created by BARBARA GERANAKI
Hi there,
the responsiveness ot the template is broken, probably because of the modules that I insert into the K2 items.
Can you help me with that please?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 4 months ago #137450 by Krikor Boghossian
Replied by Krikor Boghossian on topic Inserting modules into item
The code in general which should be used for placing modules outside index.php should be
<?php if(JModuleHelper::getModules('YOUR_MODULE_POSITION')): ?>
  <?php foreach (JModuleHelper::getModules('YOUR_MODULE_POSITION') as $module) {?>      
    <?php echo JModuleHelper::renderModule($module, array('style' => 'YOUR_MODULE_STYLE')); ?>     
  <?php }?>
<?php endif; ?>

Replace YOUR_MODULE_POSITION with the position you want and YOUR_MODULE_STYLE

in your case the code in the item.php (html/com_k2/default/item.php) should look like:
<?php if(JModuleHelper::getModules('inner_Banner')): ?>
	  <?php foreach (JModuleHelper::getModules('inner_Banner') as $module) {?>
	  	<div class="module">
	    <?php echo JModuleHelper::renderModule($module, array('style' => 'nu')); ?>
	  	</div>
	  <?php }?>
	<?php endif; ?>

Use the <?php if($this->item->params->get('itemTags') && count($this->item->tags)): ?> code block to locate the tags and place that snippet above it.

PS. ALWAYS backup before doing this and keep a backed up file in case you update your template.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • BARBARA GERANAKI
  • BARBARA GERANAKI's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 4 months ago #137451 by BARBARA GERANAKI
Replied by BARBARA GERANAKI on topic Inserting modules into item
I tried it and now I get that code
...
</div>
<?php endif; ?>
<?php endif;?>
<?php if(JModuleHelper::getModules('inner_Banner')): ?>
<?php foreach (JModuleHelper::getModules('inner_Banner') as $module) {?>
<div class="module">
<?php echo JModuleHelper::renderModule($module, array('style' => 'nu')); ?>
</div>
<?php }?>
<?php endif; ?>
<?php if($this->item->params->get('itemTags') && count($this->item->tags)): ?>
<div class="itemLinks"> ...

I guess I'm doing something wrong because nothing had changed. It's still broken

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 4 months ago #137452 by Krikor Boghossian
Replied by Krikor Boghossian on topic Inserting modules into item
Where did you use that code?

You need to add this in the item.php file.
The file is located in numovies/html/com_k2/item.php

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 4 months ago #137453 by Krikor Boghossian
Replied by Krikor Boghossian on topic Inserting modules into item
The code appears fine.

You will need to republish your modules to that position or change the: inner_Banner part with your preextisting position.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • BARBARA GERANAKI
  • BARBARA GERANAKI's Avatar Topic Author
  • Offline
  • Senior Member
More
10 years 4 months ago #137454 by BARBARA GERANAKI
Replied by BARBARA GERANAKI on topic Inserting modules into item
ok. Everything works fine now!
Thank you :-)

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


Powered by Kunena Forum