Fiji Web Design
Welcome, Guest
Please Login or Register.    Lost Password?
Re:mosLoadModules On Prepare (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:mosLoadModules On Prepare
#118
scorrea5 (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
mosLoadModules On Prepare 3 Years, 6 Months ago Karma: 0  
Hello... when i add the mosLoadModules on prepare..to the end of an article.. this appear over the title ... and no in the end of an article...

Why is this problem??

<?php
$row->text .= mosLoadModules ('position', 2);
?>
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#120
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:mosLoadModules On Prepare 3 Years, 6 Months ago Karma: 10  
I don't think the function mosLoadModules() has any return. It only "echo"s its content.

So you have mosLoadModules echoing the module content, then returning null. So you see the echoed content first, and nothing appended to the article.

You might want to use the "After Content" event. That will add the output after the article, in the order of the plugins in the Administration Panel.
If you want the output right after the article, then you can use the onprepare event, and buffer the output of your mosLoadModules() call, using output buffering:

$joomla_out = ob_get_contents();
ob_clean();
mosLoadModules ('position', 2); 
$modules_out = ob_get_contents();
ob_clean();

echo $joomla_out;

$row->text = $modules_out;
Not the most efficient way, but it should work.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#122
scorrea5 (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:mosLoadModules On Prepare 3 Years, 6 Months ago Karma: 0  
Excelent! Very Thankz!

Replace this code

$joomla_out = ob_get_contents();
ob_clean();
mosLoadModules ('position', 2); 
$modules_out = ob_get_contents();
ob_clean();

echo $joomla_out;

$row->text = $modules_out;
For this (missing dot):
$joomla_out = ob_get_contents();
ob_clean();
mosLoadModules ('position', 2); 
$modules_out = ob_get_contents();
ob_clean();

echo $joomla_out;

$row->text .= $modules_out;
Another question... Can I show this plugin in the article only? Because appear in the show of all articles in the page of categories...
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#123
admin (Admin)
Admin
Posts: 475
graph
User Online Now Click here to see the profile of this user
Re:mosLoadModules On Prepare 3 Years, 6 Months ago Karma: 10  
Sure..

In your code, check if you are on an article page. To do this you test for the URL parameters "option" and "task". The parameter "option" should be set to "com_content" and "task" should be "view".

eg:

if (mosGetParam($_REQUEST, 'option') == 'com_content' && mosGetParam($_REQUEST, 'task') == 'view') {

// put your code in here.. 

}
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#127
scorrea5 (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:mosLoadModules On Prepare 3 Years, 6 Months ago Karma: 0  
THANKZ ADMIN!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ITs SOLVED!!!!!!!!!!!!


THANKZ!!!!!!!!!!!!!!!!!
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#595
scorrea5 (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:mosLoadModules On Prepare 3 Years ago Karma: 0  
admin wrote:
$joomla_out = ob_get_contents();
ob_clean();
mosLoadModules ('position', 2); 
$modules_out = ob_get_contents();
ob_clean();

echo $joomla_out;

$row->text .= $modules_out;
QUOTE:
Sure.. In your code, check if you are on an article page. To do this you test for the URL parameters "option" and "task". The parameter "option" should be set to "com_content" and "task" should be "view". eg:
if (mosGetParam($_REQUEST, 'option') == 'com_content' && mosGetParam($_REQUEST, 'task') == 'view') {

// put your code in here.. 

}
Hello again!!! how i can do the same but for joomla 1.5 ???? thankyou!!!!
 
Report to moderator   Logged Logged  
 
Last Edit: 2009/01/14 06:57 By scorrea5.
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Joomla Downloads

DownloadsDownload our free Joomla! Components, Modules and Plugins.