[nycphp-talk] Dynamically Add Links to Text

Petros Ziogas petros.ziogas at
Fri Aug 28 06:00:05 EDT 2009

I would just like to mention a point of failure in that automated proccess.
I had to deal with this in a previous project so it's quite fresh.
What will happen if:

There are 3 articles. Article A is titled "History of America". Article B is
titled "Glorious History of America". In article C there is this text "The
book is talking about the glorious history of America". If you run an
automated proccess and the test for article A comes first then the text will
be  "The book is talking about the glorious <a href="/id1111/">history of
America</a>" and the next test will fail.

If you run a test for article B first the text will become "The book is
talking about the <a href="/id2222/">glorious history of America</a>". Then
if you test for article A it might end up being "The book is talking about
the <a href="/id2222/">glorious <a href="/id1111/">history of

The possibilities of such procedured practically ruining your content are
endless. If you want to dive into tag nesting and html validation you will
be opening another whole.

Also what will happen if an editor want to insert this "I loved the book <a
href="LINKTOAMAZON">George Washington and the Glorious history of
America</a>." and there are articles with titles using "George Washington",
"Glorious history", "History of America", "America"?

I think you get my point...

What I have ended up with is human editors. Not manually editing the links
of course. A bot proposes edits all the time and an editor decides what
changes to accept and what to reject. Of course the robot should be clever
and propose changes that make sense and not repeat the same propositions all

It's a challenging task but that's why we are here, right?

Petros Ziogas

On Fri, Aug 28, 2009 at 12:30 AM, Glenn Powell <glenn310b at> wrote:

> continuation from last post... and another idea...
> When you get the list of record ids, select enough of the text around the
> (target phrase to be "linkafied") to give it some context,
> and, at the point of publication of a new article,  display those blurbs in
> a list with a pre checked checkbox for each one.
> When the editor publishes a new article, they get a list of only what will
> be linked, with enough context to uncheck it if they
> don't want it linked.
> When they hit publish, either queue up the job, or just update and create
> the links then.
> wouldn't work so well if there were 10,000 past articles to have links
> added to...
> On Aug 27, 2009, at 4:26 PM, Randal Rust wrote:
>  On Thu, Aug 27, 2009 at 4:16 PM, Andrew Muraco<amuraco at> wrote:
>>  Personally, i think a spider/bot is the best bet, maintain a list of
>>> phrases/words that should point to links and add those in.
>> I am leaning towards thinking that is the best option. The other way
>> would be to simply provide the editor with a button they can click
>> that automatically does the updates and then provides a list of
>> articles that they need to review. If all is good, then they can
>> approve and publish.
>> --
>> Randal Rust
>> R.Squared Communications
>> 614-370-0036
>> _______________________________________________
>> New York PHP User Group Community Talk Mailing List
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the talk mailing list