Page 1 of 1

Server overloading

Posted: Mon Feb 05, 2007 3:01 pm
by user___
Hi guys,
I am not sure whether the title used is appriopriate to the I have. I am developing a multilingual site. It is a kind of a news site. The problem I have is that my boss wants it to be created in this way that when a user clicks on a word definition of its to be shown in a new window. My first idea was to create a function which will be invoked before the text is displayed(The text is got from a database) and replaces all words which casn be found in our dict table(I am not sure whether I am clean enough so:
We have minister as a word.
Before it is printed all words are checked and this is found in the dict table.
Then we replace it with

Code: Select all

<a href="javascript:">minister</a>
.
);
The other idea of mine was to insert the HTML in the very insert statement.

I have doubts about which to choose because they both have pros and cons.

If there is a better approach I would be very grateful to experience it so feel free to say what you think.

Posted: Mon Feb 05, 2007 3:21 pm
by feyd
Won't that result in a massive HTML page?

Reply

Posted: Mon Feb 05, 2007 3:44 pm
by user___
Yes, it will. These were just suggestions. Do you have any ideas?

Posted: Mon Feb 05, 2007 3:54 pm
by feyd
Must the definitions be accessible, without the user's interaction of more than a click, from the page?

The problem with pouring links all over the page is your pages become link farms. This is not very useful to many people as it's not very simple and takes far too long to process.

If the definitions must be accessible from the page, I would give the user a dictionary lookup form they can write a word or phrase into themselves.

Reply

Posted: Mon Feb 05, 2007 4:00 pm
by user___
I do agree with you and I though about a creation of a JavaSript function but then I will have to separate each word in a span or another container because for example "onClick" or "onDoubleClick" require it. There are such sites which do this witha float block of text. Even here in this forum when you post a code you have a link to http://www.php.net within each function. Any suggestions?

Posted: Mon Feb 05, 2007 4:20 pm
by feyd
The code we run here links only the function names. That's handled before the page is sent. I prefer processing as much as possible on the server.

If you must incorporate the links to the dictionary data, I would suggest only linking the first time the word appears and using CSS to set those links apart from standard links. Whether you do it through Javascript or not is up to you though.

Reply

Posted: Mon Feb 05, 2007 4:43 pm
by user___
Sorry, feyd but I do not get what you mean by showing it only the first time. How do I know whether this is the first time?Which is the user(I do not require users to be register to use this function)? What kind of identifier on user;'s browser to use(Cookie) etc.?

If I misunderstood you, please excuse me and giving me some more explnatory post would be great.

Re: Reply

Posted: Mon Feb 05, 2007 6:55 pm
by visitor-Q
user___ wrote:Sorry, feyd but I do not get what you mean by showing it only the first time. How do I know whether this is the first time?Which is the user(I do not require users to be register to use this function)? What kind of identifier on user;'s browser to use(Cookie) etc.?

If I misunderstood you, please excuse me and giving me some more explnatory post would be great.
look into session_start()

Posted: Mon Feb 05, 2007 7:51 pm
by feyd
Not the first time the page is loaded, but the first appearance of the word to minimize the amount of additional text you're injecting.