SneakyDave
Well-known member
I just checked, I get the same error you do, Headers already sent. Maybe it doesn't like the IFRAME in the template.
I just checked, I get the same error you do, Headers already sent. Maybe it doesn't like the IFRAME in the template.
It's not the iframe, and it's not your template. If you remove the contents of your entire template, the error still happens.
<?php
class Test_Listener{
public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template){
if ($hookName == 'ad_sidebar_bottom'){
$contents .= self::getTemplateCode();
}
}
public static function getTemplateCode(){
$code = <<<C
<div class="section">
<div class="secondaryContent">
<h3>test</h3>
<iframe src="http://cache.www.gametracker.com/components/html0/?host=193.218.154.228:64738&bgColor=1F2642&fontColor=8790AE&titleBgColor=11172D&titleColor=FFFFFF&borderColor=333333&linkColor=FF9900&borderLinkColor=999999&showMap=0¤tPlayersHeight=160&showCurrPlayers=1&showTopPlayers=0&showBlogs=0&width=240" frameborder="0" scrolling="no" width="240" height="348"></iframe>
</div>
</div>
C;
return $code;
}
}
hm, working nice for me with the template code from
http://xenforo.com/community/threads/creating-an-addon-and-a-weird-thing-happens-help.53005/
PHP:<?php class Test_Listener{ public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template){ if ($hookName == 'ad_sidebar_bottom'){ $contents .= self::getTemplateCode(); } } public static function getTemplateCode(){ $code = <<<C <div class="section"> <div class="secondaryContent"> <h3>test</h3> <iframe src="http://cache.www.gametracker.com/components/html0/?host=193.218.154.228:64738&bgColor=1F2642&fontColor=8790AE&titleBgColor=11172D&titleColor=FFFFFF&borderColor=333333&linkColor=FF9900&borderLinkColor=999999&showMap=0¤tPlayersHeight=160&showCurrPlayers=1&showTopPlayers=0&showBlogs=0&width=240" frameborder="0" scrolling="no" width="240" height="348"></iframe> </div> </div> C; return $code; } }
<?php
class MumbleViewer_Listener {
public static function templateHook($hookName, &$content, array $hookParams, Xenforo_Template_Abstract $template)
{
switch($hookName){
case 'ad_sidebar_bottom';
$content .= $template->create('mumble_viewer_sidebar', $template->getParams());
break;
}
}
}
hm, working nice for me with the template code from
http://xenforo.com/community/threads/creating-an-addon-and-a-weird-thing-happens-help.53005/
PHP:<?php class Test_Listener{ public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template){ if ($hookName == 'ad_sidebar_bottom'){ $contents .= self::getTemplateCode(); } } public static function getTemplateCode(){ $code = <<<C <div class="section"> <div class="secondaryContent"> <h3>test</h3> <iframe src="http://cache.www.gametracker.com/components/html0/?host=193.218.154.228:64738&bgColor=1F2642&fontColor=8790AE&titleBgColor=11172D&titleColor=FFFFFF&borderColor=333333&linkColor=FF9900&borderLinkColor=999999&showMap=0¤tPlayersHeight=160&showCurrPlayers=1&showTopPlayers=0&showBlogs=0&width=240" frameborder="0" scrolling="no" width="240" height="348"></iframe> </div> </div> C; return $code; } }
The server responded with an error. The error message is in the JavaScript console.
The code is changed just a bit (using a case statement), but I think if you ditch that original Listener.php file, and create a new one, it'll work.
Code:<?php class MumbleViewer_Listener { public static function templateHook($hookName, &$content, array $hookParams, Xenforo_Template_Abstract $template) { switch($hookName){ case 'ad_sidebar_bottom'; $content .= $template->create('mumble_viewer_sidebar', $template->getParams()); break; } } }
View attachment 49458
The code is changed just a bit (using a case statement), but I think if you ditch that original Listener.php file, and create a new one, it'll work.
Code:<?php class MumbleViewer_Listener { public static function templateHook($hookName, &$content, array $hookParams, Xenforo_Template_Abstract $template) { switch($hookName){ case 'ad_sidebar_bottom'; $content .= $template->create('mumble_viewer_sidebar', $template->getParams()); break; } } }
View attachment 49458
I don't have a grey bar showing at the top, and I don't have a "Output already sent" error message.
Did you delete that Listener.php file and create a new one? Do you still get the "Output already sent" error message?
Delete it completely, create a new one. That's what I did, and it worked.
The error message says that the output is being generated by that file starting at line one, but I can't tell why that would be. I think the file is somehow corrupted.
We use essential cookies to make this site work, and optional cookies to enhance your experience.