[nycphp-talk] Dynamically Add Links to Text
Glenn Powell
glenn310b at mac.com
Thu Aug 27 11:40:12 EDT 2009
Maybe altering the existing articles is a one time process?
Just once to add the links, based on a hash of known article titles to
date.
For future articles;
I don't see how a pre-existing article could have made reference to an
article title that hasn't been published yet.
That would mean that only new articles would need to be run through
the process at the time of publication?
and update the known article titles with the new one.
Of course, I probably don't fully understand the challenge...
Glenn
On Aug 27, 2009, at 10:04 AM, Randal Rust wrote:
> In one of our applications, we have a need to apply inline links to
> the text, and would like to figure out a way to do this dynamically. I
> have looked for this high and low, but haven't been able to find what
> I am looking for. Perhaps I am searching the wrong keywords.
>
> What we have is a repository of 1,000 articles. Each article has a
> unique title. If the title of that article appears in another article,
> we want to apply a link to the text, but only the first instance of
> the text.
>
> My thought is that we have to:
>
> 1. create an array of all titles
> 2. create a variable that holds the article text
> 3. loop through the title array and search the article text for a
> match
> 4. the first instance that a match is found, append the link and
> update the string variable
>
> The trick is that when a new article is added, they system needs to
> automatically go back to all of the existing articles and run through
> this process, which I don't like, because this won't be 100% accurate
> in the editor's eyes. each updated article needs to be reviewed. I
> also think it would cause a performance hit and dramatically slow down
> the system, especially in one installation where we have nearly 4,000
> record that would need to be updated.
>
> Personally, it seems to me that JavaScript is a better solution here,
> and to simply append those links when the page loads. Unfortunately,
> these sites all have to comply with Section 508 and other
> accessibility guidelines, so that might not be an acceptable solution.
>
> Any suggestions?
>
> --
> Randal Rust
> R.Squared Communications
> www.r2communications.com
> 614-370-0036
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php
More information about the talk
mailing list