Forum Moderators: phranque

Message Too Old, No Replies

Content rewrite on the fly - apache?/php?/perl?

How best to rewrite content...?

         

miaoux

1:37 am on Sep 18, 2007 (gmt 0)

10+ Year Member



Hi all,

I want to implement some kind of on-the-fly rewrite whereby any technical term that comes up on my website is automagically generated with a (e.g.) piece of javascript that on mouseover, pops up a small box (layer) that provides a definition of said item.

What's the best way of going about this? The same term would appear a number of times over a number of pages - so I guess this could be done at some library level, but I thought doing it at the webserver level might be easier?

Of course, then there's the possible processing overhead ... but I'm just guessing randomly now. Does anyone have any suggestions? I looked at mod_rewrite, but that seems to be just for URLs, rather than content.

Any assistance or helpful tips would be much appreciated =)

phranque

1:43 am on Sep 18, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, miaoux!

how is your content generated?

miaoux

5:57 pm on Sep 19, 2007 (gmt 0)

10+ Year Member



Hiyas, thanks for the welcome =)

It's written up manually and stored in a database. Basically they are product descriptions found in osCommerce.


M

SeanW

1:17 am on Sep 21, 2007 (gmt 0)

10+ Year Member



Include a javascript library in your page that does it on the client side. Why spend the cycles on the server level?

Sean

miaoux

2:44 am on Sep 21, 2007 (gmt 0)

10+ Year Member



I was thinking it would be more eloquent to do it that way.

I'll eventually have about 6 different languages on the site, and it's not just the product description(s) that'll require the mouseover things - it'll also be part of the product attribute descriptions (if that makes any sense to anyone).

When you say javascript library ... does that mean ajax-esque?
Or did you envisage a library with all of the definitions in each of the languages?

10 separate definitions x 6 languages = 60? Or would they be calls to the DB, which would then be 'mouseovered' via the javascript lib?

Sorry if I'm sounding dense, I'm just trying to get a better understanding of what you mean

Thanks,

m

SeanW

12:54 pm on Sep 21, 2007 (gmt 0)

10+ Year Member




I'll eventually have about 6 different languages on the site, and it's not just the product description(s) that'll require the mouseover things - it'll also be part of the product attribute descriptions (if that makes any sense to anyone).

TBH I've never done this, my response was just more of a conceptual thing based on my experience with scaling other services and seeing what other places have done. Look at the way some advertising works (intellitext, amazon), because it'll be very similar.

Conceptually you'd load the page and include a javascript library that has the smarts to parse the page and rewrite the DOM based on a set of rules. The rules would be downloaded through xmlhttprequest() (ie ajax) by the first javascript library once it figured out what language or section of the site, or whatever.

The rules could come from a database or a static xml/json file. It depends on how much data there is -- you don't want to download your whole product catalogue if there are only 3 different "things" that you'll be highlighting on the page, the database approach might be better.

This might be overkill for what you want, it might not.

Sean