1
Korfmann
WordBook Autolink
  • 2005/3/9 20:04

  • Korfmann

  • Just popping in

  • Posts: 7

  • Since: 2005/2/1 2


Hello,

this ist my first "quick & dirty" hack. The idea was, to autolink Glossary terms system wide. I don´t know, if anyone cares about or solved this problem otherwise. i find it very useful. This Hack based on XOOPS 2.0.9.2 Stable and WordBook 1.12.

All Changes were made in this file: "/class/module.textsanitizer.php"

Add this Array at the top of the class:
var $glossary = array();


Add this function (based on smiley function) and replace [YOUR_URL] with your base URL:

function &glossar($message)
        {
        
$db =& Database::getInstance();
        if (
count($this->glossary == 0)) {
            if (
$getglossar $db->query("SELECT term,entryID FROM "$db->prefix("wbentries"))){
                while (
$glossar $db->fetchArray($getglossar)){
                    
$id $glossar['entryID'];
                    
$term $glossar['term'];
                    
$termlink '$term '?';
                    
$message =& preg_replace("/((<[^>]*)|$term)/ie"'"2"=="1"? "1":"$termlink"'$message,1);
                    
array_push($this->glossary$glossar);
                    
                }
            }
        }
        elseif (
is_array($this->glossary)){
            foreach(
$this->glossary as $glossar) {
                
$id $glossar['entryID'];
                    
$term $glossar['term'];
                    
$termlink '$term '?';
                    
$message =& preg_replace("/((<[^>]*)|$term)/ie"'"2"=="1"? "1":"$termlink"'$message,1);
            }
        }
        return 
$message;
    }


Find this: "function &displayTarea"
and add the following line before return:
$text =& $this->glossar($text);


Do the same with the function "function &previewTarea".

Ok, thats it. It´s not perfect, but it works for me. Suggestions are very welcome

2
comegona
Re: WordBook Autolink
  • 2005/3/9 23:35

  • comegona

  • Not too shy to talk

  • Posts: 165

  • Since: 2003/11/9


Is there a Wordbook 1.12? Last one I saw was 1.00

3
JamesSAEP
Re: WordBook Autolink
  • 2005/3/10 0:15

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Where can I get the Wordbook module?

Thanks.

4
comegona
Re: WordBook Autolink
  • 2005/3/10 3:32

  • comegona

  • Not too shy to talk

  • Posts: 165

  • Since: 2003/11/9



5
JamesSAEP
Re: WordBook Autolink
  • 2005/3/10 17:04

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Thanks.

6
rafa_mach
Re: WordBook Autolink
  • 2005/3/25 19:38

  • rafa_mach

  • Just popping in

  • Posts: 25

  • Since: 2004/9/19


Quote:

This Hack based on XOOPS 2.0.9.2 Stable and WordBook 1.12.


I tried the hack and it didn't work. It's probably because I could not find "&display" and "&preview" command lines. Is it because I Wordbook V1? Any ideas?

7
siweb
Re: WordBook Autolink
  • 2005/3/29 7:57

  • siweb

  • Not too shy to talk

  • Posts: 150

  • Since: 2004/5/2 1


Obviously development is continuing . Version 1.14 can be found at http://www.myxoops.org/modules/wfdownloads/singlefile.php?cid=48&lid=440

8
Mithrandir
Re: WordBook Autolink

Quote:

rafa_mach wrote:
Quote:

This Hack based on XOOPS 2.0.9.2 Stable and WordBook 1.12.


I tried the hack and it didn't work. It's probably because I could not find "&display" and "&preview" command lines. Is it because I Wordbook V1? Any ideas?
the displayTarea() and previewTarea() methods are in the MyTextsanitizer class in xoops_root/class/module.textsanitizer.php

9
m0nty
Re: WordBook Autolink
  • 2005/3/29 8:17

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


nice touch :)

but couldn't you use .XOOPS_URL. instead of having to type in the base url manually..

ie..

$termlink '$term '?';


instead use >

$termlink '.XOOPS_URL.'/modules/wordbook/entry.php?entryID='$id '" target="_blank">' $term '?';


:)

10
technews
Re: WordBook Autolink
  • 2005/3/30 23:35

  • technews

  • Just popping in

  • Posts: 36

  • Since: 2005/3/30


does this think actually work ?

so if let's say I have the word "Xoops" in the latest news .. it will be automatically converted into a link that leads to the term "Xoops" in the Wordbook

right?

Sound good :)

any example pages ?

Login

Who's Online

183 user(s) are online (86 user(s) are browsing Support Forums)


Members: 0


Guests: 183


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits