1
rossb
Parse and replace keywords prior to final output?
  • 2010/3/23 17:54

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Hi;

I am using overlib for pupup definitions of words, as shown on this site:

http://www.nazisociopaths.org/modules/article/view.article.php/c1/34

You can do a "view source" to see what overlib requires...

The process of inserting the definitions is cumbersome and I want to automate this by creating a module to automatically (based on selected modules) parse for keywords (definitions) and replace with the appropriate overlib link.

The module will have checkboxes to select which module outputs should be parsed, keywords, definitions and overlib style settings.

I need a pointer regarding where in the final XOOPS rendering code I should do the search and replace.

Also need advice on how to do the equivalent of:



so include files are also parsed...

Yea, I know, newbie...

Or, if this is too much, pointers on how to do a shell script or application to pre-process the files...

Thanks;
Bill

2
bumciach
Re: Parse and replace keywords prior to final output?
  • 2010/3/23 21:13

  • bumciach

  • Not too shy to talk

  • Posts: 153

  • Since: 2007/6/25


Or maybe try connect somehow overlib with jquery highlight plugin? Especially the last example on that page - you can do simply everything with highlighted elements. It will be working after process files.
But I'm not good in javascript so I can't help much. It is just such an idea.

3
rossb
Re: Parse and replace keywords prior to final output?
  • 2010/3/23 22:49

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Thanks, but...

Client side java not the way to go. Need to search and replace for a lot of keywords. If done prior to final render, cache will minimize work. If done by some sort of pre-process step such as shell (awk/sed regex script), need to run once, any time a content file is updated.


4
rossb
Re: Parse and replace keywords prior to final output?
  • 2010/3/27 15:35

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


I decided to take another, more general (xoops independent) approach. Files are at:

http://www.nazisociopaths.org/KeyWords.tar.gz

Assuming you have set up your templates for Overlib:

Create a definitions file of format:

definition;popup text;

Modify paths and value of definitions file in:

DisableKeyWords.sh, EnableKeyWords.sh

EnableKeywords will:

- create Keywords.js (include in XOOPS theme template before header)

- traverse the directories specified, parsing *.htm, replace all keywords in definitions file, creating equivalent *.htp files with overlib popup code. *.htm file are NOT modified. Your pages must reference the parsed *.htp files.

DisableKeyWords.sh just copies original *.htm as *.htp, thereby disabling keywords.

Enjoy. This is unsupported and I will not be answering questions.


Login

Who's Online

386 user(s) are online (259 user(s) are browsing Support Forums)


Members: 0


Guests: 386


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