Jah, hogy kulcsszavak és nem topic-címek kellenek? Az se sokkal bonyolultabb, csak egy plusz táblát fel kell majd vinni:
Kód:
CREATE TABLE `ibf_terms` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`term` TEXT NOT NULL ,
`url` TEXT NOT NULL
) ENGINE = MYISAM ;
(phpMyAdmin-nal meg pillanatok alatt felpakolhatod a kifejezéseket/url-eket, amire figyelj, hogy írd át az ibf_-et arra, amit az IPB-d használ prefixként!)
A telepítés ugyanaz, kicsit a kód módosul:
Kód:
function _autoTopicLink( $text ) {
static $topicLinks = array();
if($this->parse_html) {
$text = str_replace(array('<', '>'), array('<', '>'), $text);
}
if(count($topicLinks) == 0) {
global $ipsclass;
$db =& $ipsclass->DB;
$db->simple_construct(array('select' => 'term, url', 'from' => 'terms'));
$db->simple_exec();
while($row = $db->fetch_row()) {
$topicLinks[$row['term']] = '<a class="autogenerated" href="' . $row['url'] . '">' . $row['term'] . '</a>';
}
}
foreach($topicLinks as $pattern => $replace) {
if(strpos($text, $pattern) !== false) {
$text = preg_replace('/' . $pattern . '(?![^<]*?>)/', $replace, $text);
}
}
if($this->parse_html) {
$text = str_replace(array('<', '>'), array('<', '>'), $text);
}
return $text;
}
BlackY
Könyvjelzők