i'm writing on a rather large application that will include a helpfunction with definitons etc.
i'm planning on setting up a table with in the rows
keywords and there synonyms, abreviations, plurals, ... + short description + a definition.
(or maybe 2 tables where 1 tables has a primary key, short description, definition. And the other table has one row for each keyword/synonym/plural/... and the PK of table1 as a foreign key)
now, my problem is that i want to write a function that will automatically convert these keywords in all my pages into a link to the definition-page with the primary key value from that table in the querystring (so they apear as a link and if the user clicks it, he gets the definition, if he hoovers over it, he will get the short description (like a title))
this should be done at runtime, and only on specific parts of the page (not the title etc)
I have absolutely no idea what would be the best way to write a function that does this.
I could select the complete table and dump it inside 2 arrays (1 array containing all keywords, synonyms ...) and one array containing the corresponding urls, like (<a href=\"lexicon.php?pk=10\" title=\"De eerste dag van de maand\">Begindag</a>")
and then run a str_replace on all strings in the page where i want this conversion, but i think there must be a more effcicient way to do this.
Anyone has any ideas ?