17.03.2012, 16:22
Hallo liebe Community,
Ich habe ein Forum welches auf mybb basiert und wollte dort eine Werbebanner einfügen da es kaum plugins gibt die das gut durchsetzen es aber ein Hello World plugin gibt welches ein Text dort ausgibt wo durchaus auch das Banner hin passen könnte, dachte ich mir ersetzen wir den Standard Text einfach gegen den Banner...
Das Problem ist aber nachdem ich das gemacht habe war die Page komplett weiß.. :-(
Hier mal die Codes
Ich habe ein Forum welches auf mybb basiert und wollte dort eine Werbebanner einfügen da es kaum plugins gibt die das gut durchsetzen es aber ein Hello World plugin gibt welches ein Text dort ausgibt wo durchaus auch das Banner hin passen könnte, dachte ich mir ersetzen wir den Standard Text einfach gegen den Banner...
Das Problem ist aber nachdem ich das gemacht habe war die Page komplett weiß.. :-(
Hier mal die Codes
PHP-Code:
<?php
/**
* MyBB 1.6
* Copyright 2010 MyBB Group, All Rights Reserved
*
* Website: http://mybb.com
* License: http://mybb.com/about/license
*
* $Id: hello.php 5297 2010-12-28 22:01:14Z Tomm $
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("pre_output_page", "hello_world");
$plugins->add_hook("postbit", "hello_world_postbit");
function hello_info()
{
/**
* Array of information about the plugin.
* name: The name of the plugin
* description: Description of what the plugin does
* website: The website the plugin is maintained at (Optional)
* author: The name of the author of the plugin
* authorsite: The URL to the website of the author (Optional)
* version: The version number of the plugin
* guid: Unique ID issued by the MyBB Mods site for version checking
* compatibility: A CSV list of MyBB versions supported. Ex, "121,123", "12*". Wildcards supported.
*/
return array(
"name" => "Hello World!",
"description" => "A sample plugin that prints hello world and prepends the content of each post to 'Hello world!'",
"website" => "http://mybb.com",
"author" => "MyBB Group",
"authorsite" => "http://mybb.com",
"version" => "1.0",
"guid" => "",
"compatibility" => "*"
);
}
...
function hello_world($page)
{
$page = str_replace("<div id=\"content\">", "<div id=\"content\"><p>Hello World!<br />This is a sample MyBB Plugin (which can be disabled!) that displays this message on all pages.</p>", $page);
return $page;
}
function hello_world_postbit($post)
{
$post['message'] = "<strong>Hello world!</strong><br /><br />{$post['message']}";
}
?>
Und hier der veränderte..
PHP-Code:
<?php
/**
* MyBB 1.6
* Copyright 2010 MyBB Group, All Rights Reserved
*
* Website: http://mybb.com
* License: http://mybb.com/about/license
*
* $Id: hello.php 5297 2010-12-28 22:01:14Z Tomm $
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook("pre_output_page", "hello_world");
$plugins->add_hook("postbit", "hello_world_postbit");
function hello_info()
{
/**
* Array of information about the plugin.
* name: The name of the plugin
* description: Description of what the plugin does
* website: The website the plugin is maintained at (Optional)
* author: The name of the author of the plugin
* authorsite: The URL to the website of the author (Optional)
* version: The version number of the plugin
* guid: Unique ID issued by the MyBB Mods site for version checking
* compatibility: A CSV list of MyBB versions supported. Ex, "121,123", "12*". Wildcards supported.
*/
return array(
"name" => "Hello World!",
"description" => "A sample plugin that prints hello world and prepends the content of each post to 'Hello world!'",
"website" => "http://mybb.com",
"author" => "MyBB Group",
"authorsite" => "http://mybb.com",
"version" => "1.0",
"guid" => "",
"compatibility" => "*"
);
}
...
function hello_world($page)
{
$page = str_replace("<div id=\"content\">", "<div id=\"content\"><p><a href="http://www.banner.de/" _fcksavedurl="http://www.banner.de/" target="_blank"><img src="http://banner.de/banner.jpg" border="0" alt="banner.de"></a></p>", $page);
return $page;
}
function hello_world_postbit($post)
{
$post['message'] = "<strong>Hello world!</strong><br /><br />{$post['message']}";
}
?>
Könnte mir einer sagen was falsch ist ?