ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I got as far as displaying a text input box where a user can type in a name and a message (okay, I just stole it from another site, but it seems to work fine). I need the username, the comment they post, and the date it was posted to appear on the same page as the comment box. (The comment box is above the comment area, so when a user submits a comment, it will appear right below it, along with other comments users will submit, separated by a line or something.
What do I have to do now? How can I make the submitted comments be saved in a separate file (it doesn't have to be, but I'm assuming that's how it works), and displayed?
Last edited by SentralOrigin; 01-07-2009 at 01:08 AM.
I don't understand any of this stuff. How do I make it grab the comment, put it into a file, then read the file again and post the comment where I want it to on the page?
Maybe its not clear to you that HTML = Hypertext Markup Language. Its a page layout lang, not a programming language. IOW you need a prog lang (ie to implement CGI - Computer Gateway Interface ability).
You need a lang that is Turing complete ie can actually manipulate/implement stuff like vars, loops, decisions, files etc. HTML is NOT that lang.
Use PHP (as suggested) or Perl etc.
1. A web server (for example, Apache)
<= your bulletin board program is basically a "web application" run off of your web server.
2. A database (for example, mySQL)
<= a database is usually better than a text file to hold comments ... and, for that matter, to store usernames and other stuff related to your bulletin board.
3. A scripting language (for example, Perl, PHP or ASP.Net)
<= The scripting language can read and write to the database and dynamically generate the HTML the user sees in his browser.
The script is the "glue" that makes a web application possible.
Please let us know if you are running your own web server, or are you using a hosted service.
If you are running your own web server, then you will be less restricted in what you can run (although you will need to install and configure the server yourself).
If you are using a hosted service, you may find that PHP is already installed and configured, although a lot of hosted services do not allow for running a database on their cheapest band.
If this is a hosted service, create a file called info.php
Code:
<?php phpinfo(); ?>
Then browse to that page. If PHP is installed you wil be given an information page.
When a user clicks on 'Comments,' it leads to another page that looks just like the homepage, except it only displays that one news article that the person clicked on 'Comments' for:
The format I want for the Comments section below the article is "Posted by [insert user here] on [insert date here]" followed by a break, the person's message, then a break, then a line to separate the comment from the next comment that will be displayed below that.
The Comment input part between the article and the comments would look like this (just not as ugly):
you'll definitely need a database and php for that (or perl, not familiar with it though...)
as someone mentioned already, php isn't that difficult to learn.
but with input forms etc you will also need to look into 'SQL injections'.
a database table design for that shouldn't be too complex I reckon
ID -- title -- text -- date_entered -- linked_article_id
that should be it.
comments entered into your form will be processed via php and entered into the db,
and from there it can be accessed again via php to display the comments to specific articles order by date
on a given page.
But I wasn't sure which snippets of code I needed to copy out to make the information from the form on my website page be put into a MySQL database I just created.
not sure.
will maybe have a look at it tomorrow, when I'm not half asleep
but wondering though, why not take one of the many free available (under the GPL) tools instead of one where you have to prominently show up where it comes from, or buy a licence for it?
here's the installation guide from the accompanying PDF:
1. Connect to your web server using an FTP program.
2. Create a new folder on your server named i.e. comments.
3. Upload the whole script including all files and folders to your server into the new
folder. Make sure the original file structure appears on the server. Read more details
in chapter 4.2 Upload.
4. Make sure the script folder and the sub-folder cache are writable by the script
(chmod 777). Read more details in the chapter 4.3 File and Folder Permissions. If
those folders are not writable the installation will fail.
5. Call the admin area of the script in your browser: http://www.example.com/comments/admin/
6. You are probably seeing now the installation screen of the script. Please make sure
you have the database access data. Read more details in chapter 4.4 Database
Access Data.
7. Choose a prefix for the database tables. Default value is c5t_ and there is actually
no need to change that unless you want to have more than one installation of the
script side by side.
8. Enter the information for the admin account you want to create and use, once the
script is working.
9. Click the button Install Now. In case the installation was successful, you will be
provided with a link to the login screen where you can use the account data you just
entered.
I did all of that, and it worked fine, except when I load it, it goes to a separate comment page, and I don't like the way it displays on separate pages. I want it to display on my own page that I already made, along with the article above it
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.