- Posts: 38
COMMUNITY FORUM
Banners between items
- Per Mork
-
Topic Author
- Offline
- Junior Member
Less
More
12 years 10 months ago - 12 years 10 months ago #67437
by Per Mork
Banners between items was created by Per Mork
I asked about this beforet, but it never got answered, and it start to become an important issue for me. Is it possible to place banners or module locations between items in some way?
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
12 years 10 months ago #67438
by Lefteris
Replied by Lefteris on topic Re: Banners between items
Hi. Yes of course. You can load module positions inside K2 template overrides using the Joomla! API:
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$params = array('style' => 'xhtml');
foreach (JModuleHelper::getModules($position) as $module)
{ echo $renderer->render($module, $params);}
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$params = array('style' => 'xhtml');
foreach (JModuleHelper::getModules($position) as $module)
{ echo $renderer->render($module, $params);}
Please Log in or Create an account to join the conversation.
- Per Mork
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
12 years 10 months ago #67439
by Per Mork
Replied by Per Mork on topic Re: Banners between items
Thank you for the answer! :cheer:
Could you be a bit more spesific, where do I place this code?
Do I place it at the point where I want the module possition in the category.php file?
And how do I name the possition?
Could you be a bit more spesific, where do I place this code?
Do I place it at the point where I want the module possition in the category.php file?
And how do I name the possition?
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
12 years 10 months ago #67440
by Lefteris
Replied by Lefteris on topic Re: Banners between items
This code will be placed in K2 template files where you want to load a position. I cannot know the name of the position, it's your site , you know it.
Please Log in or Create an account to join the conversation.
- Per Mork
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
12 years 10 months ago #67441
by Per Mork
Replied by Per Mork on topic Re: Banners between items
I think you misunderstood my question a bit.
I am quite ok with how to place module possition in the normal index.php file. But I am relative new in handle K2 files.
I want to place a banner right under the first item on the frontpage. I have created an override no prob. I placed your code in the category.php at the place where the leading item stop. But it has to be more than that. This code in itself does not create the possition, one I can give a name like "userX" and assign a banner module in Module Manager.
What more must I do?
I am quite ok with how to place module possition in the normal index.php file. But I am relative new in handle K2 files.
I want to place a banner right under the first item on the frontpage. I have created an override no prob. I placed your code in the category.php at the place where the leading item stop. But it has to be more than that. This code in itself does not create the possition, one I can give a name like "userX" and assign a banner module in Module Manager.
What more must I do?
Please Log in or Create an account to join the conversation.
- Per Mork
-
Topic Author
- Offline
- Junior Member
Less
More
- Posts: 38
12 years 10 months ago #67442
by Per Mork
Replied by Per Mork on topic Re: Banners between items
Never mind. I figured out. Thanks anyway...
Please Log in or Create an account to join the conversation.
- Rick
-
- Offline
- New Member
Less
More
- Posts: 1
10 years 11 months ago #67443
by Rick
Replied by Rick on topic Re: Banners between items
I have the same problem. Trying to place a banner advert module between Leading and Primary Count in category.php...
What code did you end up putting in there...?
Answers appreciated.
What code did you end up putting in there...?
Answers appreciated.
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
Less
More
- Posts: 8743
10 years 11 months ago #67444
by Lefteris
Replied by Lefteris on topic Re: Banners between items
@Rick
The code is still the same:Just replace 'your-position' with the module position you want to load.
The code is still the same:
<?php
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$params = array('style' => 'xhtml');
foreach (JModuleHelper::getModules('your-position') as $module)
{ echo $renderer->render($module, $params);}
?>
Please Log in or Create an account to join the conversation.