Sponsor-Board.de

Normale Version: Hilfe (Problem Gelöst)
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
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

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 ?

Du darfst keine doppelten Anführungszeichen nehmen:

Ersetz mal deinen Link hiermit:

<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>

Edit:

[Link: Registrierung erforderlich] musst du natürlich ändern, Bild ist ja nicht vorhanden.
Wenn ich dort

PHP-Code:
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;

was anderes reinschreibe wie "Apfel" gibt er mit auf der Website auch Apfel aus... es wird bloß weiß wenn ich den img code einbaue... den mag er nicht :-(

Weil du durch das erste " im Link Code die Variable wieder schließt.

Das hier geht einwandfrei:

PHP-Code:
$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='https://www.google.de/images/srpr/logo3w.png' border='0' alt='banner.de'></a></p>"$page); 


Leg dir am besten mal einen PHP Editor / Text Editor zu der Color Highlighting hat, dann sieht man sowas sofort ( btw. man siehts sogar hier im Forum )

Jetzt geht es.

Mega dank.
Referenz-URLs