Hm, 2000 replacements per page view? Some benchmarks would be nice to have, but that sounds like an awful lot.
Any way to get around this? ie: Can this be done on a mass-scale one time with static documents, or are you loading [somewhat] dynamic data from a db, then parsing it for display?
What about caching the content with smarty? I recently wrote a horrid little "intranet CMS" thing for work where the page content is in a DB and users link from page to page in a wiki fashion. Sorta.. eg:
Quote:
|
Click [login_help | here] for help with logging in.
|
So the data between the brackets would be replaced with: <a href="index.php?page=login_help">here</a> . (if the "| here" was left out, then "login_help" would be used as the link description) All of that is done via preg_replace().
(it also parses for %INCLUDE{"page_name"}% for inline page inclusion .. but same concept)
After that nothing else needs to be parsed until the page content is changed.
..The main thing is: what are your specific rules for replacement? How does know to link "have" to "foo" ?
-r