PDA

View Full Version : 2 Beginner Questions



jamesybsu
26 Sep 2008, 08:42 AM
Hello all! I just started a site and I have two questions that would really help me out.

First - I have a news section on my website that I want people to be able to comment on. I have searched the web forever on this, but I want people to be able to click the comment section below the article which will redirect them to another page where they can add/view comments. I also want people to be able to see how many comments have been posted on the original article. Whats the best way of doing this?

Second - I have a sidebar on my website that provides a quick link to an article that has been posted. Is there anyway I can make that sidebar once and reference throughout the other pages on my website so I don't have to update each individual page?

Thanks in advance for your help.
p.s. the website is http://www.socomfans.com

Wickham
26 Sep 2008, 11:41 AM
The second question means you need to use PHP "include" file. You make one page complete with the sidebar (you've got this already) then open Notepad and cut out all the sidebar code, probably from <div class="post">
<div class="title">
<h2><a href="#">SOCOM: Confrontation BETA</a></h2>...........................
to </div>, and paste it into Notepad and save as sidebar.inc (no html tags, body tags, head section)

then in the space where you cut out the code put this code:-
<?php include ("sidebar.inc"); ?>

then save the main page as something.php instead of something.html

and do the same on all the other pages so that you only have to edit one sidebar.inc file in future. It doesn't matter how much or how little you cut and paste as long as it's the same on all pages. The server just replaces the PHP code with the .inc file code before downloading. Check that your host supports PHP.

You will only see the result when viewing the page online (unless you get Apache to run the PHP on your computer) as it has to be processed.

See http://www.wickham43.net/serversideincludes.shtml

Your first question is a bit complicated but it looks like another job for PHP; there's another board for PHP on this forum.

Alternatively you could use a standard comment program either on the same page or on a separate page which is accessed from a normal link:-
http://www.cbox.ws/
or Wordpress http://wordpress.org/