Sponsor-Board.de
Thema geschlossen  Thema schreiben 

Hilfe (Problem Gelöst)

Verfasser Nachricht

Beiträge: 50
Bewertung: 6
Registriert seit: Jan 2012
Status: offline


Beitrag: #1
Hilfe (Problem Gelöst)

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 ?

Dieser Beitrag wurde zuletzt bearbeitet: 17.03.2012 16:49 von GeCraxx.

17.03.2012 16:22
 
Alle Beiträge dieses Benutzers finden

Beiträge: 334
Bewertung: 3
Registriert seit: Sep 2011
Status: offline


Beitrag: #2
RE: Hilfe

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.

Dieser Beitrag wurde zuletzt bearbeitet: 17.03.2012 16:37 von gentlemon.

17.03.2012 16:29
 
Alle Beiträge dieses Benutzers finden

Beiträge: 50
Bewertung: 6
Registriert seit: Jan 2012
Status: offline


Beitrag: #3
RE: Hilfe

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

17.03.2012 16:37
 
Alle Beiträge dieses Benutzers finden

Beiträge: 334
Bewertung: 3
Registriert seit: Sep 2011
Status: offline


Beitrag: #4
RE: Hilfe

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 )

Dieser Beitrag wurde zuletzt bearbeitet: 17.03.2012 16:43 von gentlemon.

17.03.2012 16:40
 
Alle Beiträge dieses Benutzers finden

Beiträge: 50
Bewertung: 6
Registriert seit: Jan 2012
Status: offline


Beitrag: #5
RE: Hilfe

Jetzt geht es.

Mega dank.

17.03.2012 16:48
 
Alle Beiträge dieses Benutzers finden
Thema geschlossen  Thema schreiben 

Möglicherweise verwandte Themen...
Thema: Verfasser Antworten: Ansichten: Letzter Beitrag
Question MySQLi Update funktioniert nicht [GELÖST] pixodoo 5 2.061 11.11.2016 18:14
Letzter Beitrag: pixodoo
  *gelöst" SFTP Autologin VarmintLP 5 2.126 22.04.2015 22:58
Letzter Beitrag: VarmintLP
  *gelöst* Linux Skript Case VarmintLP 0 1.408 10.03.2015 09:13
Letzter Beitrag: VarmintLP
  *gelöst* PHP/jQuery VarmintLP 6 1.746 25.02.2015 10:37
Letzter Beitrag: VarmintLP
  *Gelöst* Mehrere Parameter für Script mitliefern VarmintLP 5 1.456 18.12.2014 13:20
Letzter Beitrag: Aaron

 Druckversion anzeigen
 Thema einem Freund senden
 Thema abonnieren
 Thema zu den Favoriten hinzufügen

Sponsor-Board.de

Community
Über uns
Partner
Powered by Mybb: Copyright 2002-2024 by MyBB Group - Deutsche-Übersetzung von Mybb.de
 
© 2007-2024 Sponsor-Board.de - Hosted by OVH

Willkommen auf SB!   Sie benötigen ein Sponsoring?   1. Anmelden   2. Sponsoring-Anfrage erstellen   3. Nachrichten von Sponsoren erhalten   Kostenlos!   Jetzt registrieren