Page 1 of 1

Re: Lightbox plugin

Posted: Wed Apr 18, 2007 10:17 am
by garvinhicking
Hi!

I think the entry ID should be evailable in the $eventData array, within the 'Frontend_display' cycle where the preg_replace is executed. ($eventData['id']).

However, the current preg_Replace cycle cannot incorporate that in the $regex and $sub patterns, there needs to be a dynamic placeholder that is substituted with the entryid, either via printf or also via a second preg_replace. Of course that would impact performance by roughly 50%, if a second preg_replace is added for each entry call...

Best regards,
Garvin

Posted: Wed Apr 18, 2007 3:24 pm
by garvinhicking
Hi Rob!

Phew. I'm afraid I see no way to add a backreference, because $eventData['id'] would need to be contained within $eventData[$element] inside the '<a href>' stuff. So you'd need at least one more regular expression preg_replace call to add the ID into that. Of coure that would then be just the same impact than issuing a second preg-replace call to replace something like '%ID%' with the current ID.

Of course this simple replacement of %ID% could be done with a simple str_replace call whose impact would not be as bad, but still more overhead than currently.

The whole preg_replace call could be modified to a preg_replace_callback, but I can't tell how much this impacts the performance. Maybe it is less than 2 replacement calls, but maybe it equals to that...