Durch Deinen Tipp konnte ich schonmal sehen dass die Variablen korrekt ausgelesen wurden. Nann habe ich egtl. nur an der Outputzeile gedreht.
Dann hab ich nochmal vorsichtshalber in die link.txt geschaut und geprüft ob da noch irgendwelche unsichtbaren Zeichen drin waren, war aber nicht.
Ich habe das Gefühl das diese Output-Zeile nicht richtig funzt wenn der Inhalt nicht als Variable anfängt, macht irgendwie keinen Sinn aber mit meinem Workaround funzt es.. :S
Crazy...
Hier das Ergebnis:
global_replacer.php [put into frontend_render]
Hey Marcus, wolln wa das als hack in einen eigenen thread posten, könnte ja bei vorsichtiger Anwendung sehr nützlich sein und geht in diesem Thema hier mglw. etwas unter.
Code: Select all
<?php
$datei = "cms/config/links.txt";
$wordlist = file($datei);
for ($i = 0; $i < count($wordlist); $i++) {
$wordlist[$i] = explode(";" , $wordlist[$i]);
$wordlist[$i]['keyword']=$wordlist[$i][0];
$wordlist[$i]['link']=$wordlist[$i][1];
}
function mytag($keyword,$link) {
//$output="<a href=\"http://" . $link . "\" target=\"_blank\">" . $keyword . "</a>";
//$output='<a href="http://' . $link . '" target="_blank">' . $keyword . '</a>';
//what should the keywords be replaced with? Change here:
$linker = '<a href="http://'.$link.'" target="_blank">'.$keyword.'</a>';
$output = $linker;
return $output;
}
$i=0;
while ($i <= count($wordlist)) {
$content['all'] = str_replace($wordlist[$i]['keyword'],mytag($wordlist[$i]['keyword'],$wordlist[$i]['link']),$content['all']);
$i++;
}
?>
Code: Select all
x_enym;www.enym.com
x_videos;www.phorce.de
INSTALL:
If you want to replace certain words sitewide:
1. Create a php file in the frontend_render folder
2. create a file with the keywords and the links in config folder
done!
BE CAREFUL! ONLY USE UNIQUE WORDS as keywords. Do only use this script if you know what to do!