module position within article

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
hsarora
Sat Oct 04, 2014 6:03 am
Reply with quote
Report this post
Hi,

I have a issue in module positioning. I followed the page instructions (https://www.gavick.com/documentation/jo ... -position/) and at last step to call module, page ends with error.

I need to load module with in article. So I went to gk_news2 -> html -> com_content -> article -> default.php

When I entered this
=================================================
<?php if($this->API->modules('article_bottom')) : ?>
<section id="gkMainbodyBottom">
<jdoc:include type="modules" name="article_bottom" style="<?php echo $this->module_styles['article_bottom']; ?>" />
</section>
<?php endif; ?>
=================================================

Browser shows the following errors:

1. Undefined property: ContentViewArticle::$API in \templates\gk_news2\html\com_content\article\default.php on line 311
2. Fatal error: Call to a member function modules() on a non-object in templates\gk_news2\html\com_content\article\default.php on line 311


This means Object and Property not called in article- > default.php

Anyone tried to load module in article please?

Thanks
User avatar

GK User
Sat Oct 04, 2014 8:41 am
Reply with quote
Report this post
Hi,
something I don't understand,
if you know Joomla well you should know that you don't have to edit any PHP file to load module inside article.

1) http://docs.joomla.org/How_do_you_put_a ... article%3F
2) https://www.ostraining.com/blog/joomla/ ... oadmodule/

p.s.
Please do not edit php if you're not sure your knowledge, we do not support fixing such a customization later.
User avatar
Platinum Boarder

hsarora
Sat Oct 04, 2014 9:24 am
Reply with quote
Report this post
Hi,

First, thank you for the response.

I have a know how to add load modules manually in article content. I would like to add permanent position within article and assign module to it. This means, It will automatically load when assigned to certain menu/category items.

I have followed gavick documentation to add module position to News 2 template which is if I am right ask to edit php files.

So I am sure, I haven't done any hideous crime by amending any php file.

All I am asking you support for having module position in template. Could you please tell me how can I add module position in articles. I am sure if you can generate documentation for adding new module position, this is not such a difficult thing to achieve.

I hope you understand my view point and will direct me right approach to solve this issue.

Thanks in advance.
User avatar

GK User
Sat Oct 04, 2014 10:50 am
Reply with quote
Report this post
We have manual how to add new module position in template layout, not in article, this is "big" difference.
User avatar
Platinum Boarder

hsarora
Sat Oct 04, 2014 4:12 pm
Reply with quote
Report this post
No worries Oscar!!

Here is the solution...

Code: Select all
        <?php
            $modules =& JModuleHelper::getModules('module_position_name');
            foreach ($modules as $module) {
                echo JModuleHelper::renderModule($module);
            }
        ?>


Replace 'module_position_name' with newly created 'module position'

Cheers!
User avatar


cron