G
Gelöschtes Mitglied 433
GAST
Hallo,
ich schreibe eine Extension, die in einem Textarea Daten hinzufügen soll. Das Problem ist, dass die Wiki Parser irgendwelche Tags selbsthinzufügt. Wie kann man vermeiden. Ich habe das gleiche Problem in einem anderen Forum gestellt und die haben mir als Tipp http://www.mediawiki.org/wiki/Manua...dification_of_my_extension.27s_HTML_output.3F gegeben. Ich habe es implementiert, aber als Ausgabe kriege ich das gewünschte Ausgabe mit <pre> im Textarea. Hier ist die Kode die ich geschrieben habe.
Hier http://pp.info.uni-karlsruhe.de:83/index.php/Publikation_details?id=lochbihler09jase können Sie anschauen wie die Extension funktioniert und das Problem im Bibtex - textarea. Ich suche den Fehler seit einigen Tagen, aber ohne Erfolg. Danke im Voraus!
Gelöst!
I habe ein Beispiel gefunden, wo es besser erklärt ist, wie man das Problem umgehen kann.
Ich hoffe, dass das an allen hilft, die das gleiche Problem haben!
ich schreibe eine Extension, die in einem Textarea Daten hinzufügen soll. Das Problem ist, dass die Wiki Parser irgendwelche Tags selbsthinzufügt. Wie kann man vermeiden. Ich habe das gleiche Problem in einem anderen Forum gestellt und die haben mir als Tipp http://www.mediawiki.org/wiki/Manua...dification_of_my_extension.27s_HTML_output.3F gegeben. Ich habe es implementiert, aber als Ausgabe kriege ich das gewünschte Ausgabe mit <pre> im Textarea. Hier ist die Kode die ich geschrieben habe.
Code:
$wgHooks['ParserAfterTidy'][] = 'showPublications';
$wgExtensionFunctions[] = 'showPublications';
function myextParserAfterTidy(&$parser, &$text) {
// find markers in $text
// replace markers with actual output
$keys = array();
$marker_count = count($markerList);
for ($i = 0; $i < $marker_count; $i++) {
$keys[] = 'xx-marker' . $i . '-xx';
}
$text = str_replace($keys, $markerList, $text);
return true;
}
function showPublications() {
global $wgParser;
$wgParser->setHook( 'publications', 'doPublications' );
return true;
}
function doPublications( $input, $argv ) {
global $markerList;
//
if($_GET['id']!=""){
$output = viewPublication($_GET['id']);
} else{
if($_GET['sort']==1){
$output = getAllPubsByCategory($argv['type']);
}else
$output = getAllPubsByYear($argv['type']);
}
$markercount = count($markerList);
$marker = "xx-marker".$markercount."-xx";
$markerList[$markercount] = $output;
return $output;
}
Hier http://pp.info.uni-karlsruhe.de:83/index.php/Publikation_details?id=lochbihler09jase können Sie anschauen wie die Extension funktioniert und das Problem im Bibtex - textarea. Ich suche den Fehler seit einigen Tagen, aber ohne Erfolg. Danke im Voraus!
Gelöst!
I habe ein Beispiel gefunden, wo es besser erklärt ist, wie man das Problem umgehen kann.
Code:
$wgExtensionFunctions[] = "wfExampleExtension";
function wfExampleExtension() {
global $wgParser;
# register the extension with the WikiText parser
$wgParser->setHook( "example", "renderExample" );
}
# The callback function for converting the input text to HTML output
function renderExample( $input, $argv, &$parser ) {
$output = "Here is the form: \n";
$output .= "<form action='/path/to/form/processor/doSomething.php' method='post'>\n";
$output .= "Enter your name: <input type='text' name='yourName' />\n\n";
$output .= "<input type='submit' value='Submit' />\n";
$output .= "</form>\n";
# Using base64 within an XML comment to sneak past the parser
return '';
}
# Wrapping this for safety, just in case another extension beat us to it!
if (!function_exists('processEncodedOutput')) {
# Happens just before page display, after all processing
$wgHooks['OutputPageBeforeHTML'][] = 'processEncodedOutput';
# Search and replace the XML comments with the hidden, encoded content
function processEncodedOutput( &$out, &$text ) {
$text = preg_replace(
'//e',
'base64_decode("$1")',
$text
);
return true;
}
}
Ich hoffe, dass das an allen hilft, die das gleiche Problem haben!