...

View Full Version : A different kind of 'comment' script needed



judgedredd
08-09-2012, 07:31 PM
Having done a search on scripts and trying to find one that fits my criteria and not finding anything that I was looking for I am posting this to see if someone knows where to find this type of script or who could help me make one.

What I looking for is a script that will post a comment that has just been typed into the webpage that the script is on, just above the comment box where one types it. What I would also like is for the comments to appear one after the other in the same place instead of having them all appear on one page. So instead of a whole page of comments the script will show the comments in rotation, first one, then another, then another, etc, and loop back to the first comment then do it again indefinitely.

The comments need to be stored in a database (MySql) and retrieved then displayed for x amount of seconds based upon the number of characters and spaces in the comment. The transition of one comment to another would be a fade effect or scroll effect (upwards). I am also trying to stick to php without any javascipt.

The server is an Apache server so can only do php not ASP.

If anyone can help me on this it would be most appreciated.

Len Whistler
08-09-2012, 07:56 PM
The comments need to be stored in a database (MySql) and retrieved then displayed for x amount of seconds based upon the number of characters and spaces in the comment. The transition of one comment to another would be a fade effect or scroll effect (upwards). I am also trying to stick to php without any javascipt.

It has to be Javascript.

Also as a user I would find it annoying to half read a message and it scrolls to the next one. You should let the user click a next button.



--

judgedredd
08-09-2012, 08:08 PM
Ok. Your point is valid as I get annoyed too. So 'Next' button include.

Can you explain why javascript would be needed? Is it because of the transition from one comment to another? Or some other reason?

If there is now a 'Next' button all that would do is retrieve the next comment from the DB and display it.

Fou-Lu
08-09-2012, 08:16 PM
PHP is a server side language. Its incapable of providing rotating effects or animation.

The entire behaviour you describe would be done using AJAX (which is just a JS technology) to communicate with PHP. PHP's job will be to accept the posting and write it to a database, as well as retrieve the comment. To create the next, all you do is use AJAX to poll both for the comment itself, as well as a link to the "next" comment.

Len Whistler
08-09-2012, 08:17 PM
Ok. Your point is valid as I get annoyed too. So 'Next' button include.

Can you explain why javascript would be needed? Is it because of the transition from one comment to another? Or some other reason?


Yes ..... Unless HTML 5 with CSS can do transitions. I'm not into HTML 5 yet.


If there is now a 'Next' button all that would do is retrieve the next comment from the DB and display it.

Yes .... And that's very easy with PHP.


--

judgedredd
08-10-2012, 01:53 PM
PHP is a server side language. Its incapable of providing rotating effects or animation.

One could also use an opaque layer that transitions to transparent using css/html 5 I think.

Fou-Lu
08-10-2012, 02:54 PM
Maybe, but I don't do client side languages. All I can say is that PHP is incapable of doing this; it can only provide the data required to the client language to work with.

Arcticwarrio
08-10-2012, 03:52 PM
you could have the next button reloading the same page with the next comment


EDIT
you would need to use page transition tho and not just the comment

DrDOS
08-11-2012, 03:40 AM
Here's one way you could do this. Declare a javascript array. As each comment is entered push it into the array. You may have to omit or escape any double quotes or commas for the array to work. Then just have a little script that randomly selects elements of the array to display. As for saving them to a database you could put the array into a hidden input value and upload it in a form. But a JS array uploaded that way will be a comma separated list so it will have to be dealt with that way. Or you could format it as a long string with another separator like the | , my favorite for that since it isn't used for much else.

judgedredd
08-16-2012, 05:39 AM
Thank you everyone for your inputs. This is a bit beyond my capabilities at the moment as I am not java script-savvy.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum