| |
|
| Viewing Topic: Comments
Script: New
Comments For
Entries On One
HTML Page? |
chinako |
|
Subject: "Comments
Script: New
Comments For
..."
Posted: @ 11:14 am on Sep 28 2007 |
|
|
Member #: 421 Rank: User - (6) Since: 09/26/07 Posts: 6 From: Reading, MA
|
I'm brand new
to the wonder
that is PHP,
and thanks to
bs0d I feel
that I'm
getting a good
handle on
it!
Of course, I
have more
questions! So
here is my
latest one:
The script
seems to be
written for one
page that would
only have one
entry that
requires
comments. Is
there any way
to modify the
script to
gather comments
for multiple
entries on the
same HTML page?
I have a blog
I'd like to get
comments on and
it has many
entires per
HTML page... is
there a
numbering
system I could
put in place so
that the
comments will
come up based
on the entry
they are left
for and not
just all at
once spaning
over a year?
Also, where do
I add the
comment.php
link on my HTML
files? Within
the
<head>
section or
before it
somewhere?
Thanks so much!
|
Viewed: 4,371 Times | |  |
bs0d |
| Subject: "re: Comments
Script: New
Comments ..."
Posted: @ 2:14 pm on Sep 28 2007
|
|
|
 Member #: 1 Rank: Admin. - (1,495) Since: 02/05/05 Posts: 590 From: USA
|
Include it
wherever you
want the
comments to
appear. So if
you include it
in the head,
then your
comments will
display before
the rest of
your site.
Typically,
webmasters put
them at the
bottom of the
article or
blog.
Also I notice
you said HTML
page; I just
want to remind
you that your
pages should
have a .php
extension to be
able to execute
PHP coding.
If you want to
display all
comments, Just
Modify the
query: SELECT *
FROM `comments`
ORDER BY `date`
ASC. Something
like that would
show the
latest. Since
the table in
the DB holds
the URL, you
could display a
link to each
like this:
<a
href="<
;?
echo($result-&g
t;url);?>&q
uot;
title="&l
t;?
echo($result-&g
t;title);
?>">
; <?
echo($result-&g
t;title); ?>
</a>
something like
that. That
would be inside
a while loop
where $result =
mysql_fetch_obj
ect($query)
|
Viewed: 4,366 Times | |  |
chinako |
| Subject: "re: Comments
Script: New
Comments ..."
Posted: @ 7:50 pm on Sep 28 2007
|
|
|
Member #: 421 Rank: User - (6) Since: 09/26/07 Posts: 6 From: Reading, MA
|
Now if I just
want the
comments to
show up per
entry as
opposed to all
at once, when I
put the code
under each
entry the
comments for
that entry
won't come up
for any other
entry,
right?
And if I have
existing HTML
pages that
require the
comments, can I
simply rename
them to be .PHP
files, or do I
need to add
something to
the existing
pages to make
them PHP
friendly?
|
Viewed: 4,357 Times | |  |
bs0d |
| Subject: "re: Comments
Script: New
Comments ..."
Posted: @ 11:16 am on Sep 29 2007
|
|
|
 Member #: 1 Rank: Admin. - (1,495) Since: 02/05/05 Posts: 590 From: USA
|
Yea, like this
site - I have 1
script that is
designed to
show articles,
based on the ID
passed to it.
So in the
script, the
query will
select the
article from
the database
where id = xx.
When someone
comments on a
page, that
unique URL is
stored. So if
someone
comments on
page 2 of
article 1, then
the comments
script will
only show those
comments when
your on that
specific page
of that
specific
article.
You should be
able to change
it to a .php
extension no
problem, give
it a shot, test
the stuff out.
One thing is,
if your blogs
or pages
(whatever
you're wanting
comments on)
are static -
meaning you
manually
created an HTML
page for each
one, then you
will have to
insert the
comments script
on each of
those pages you
want to allow
comments. If
that's the
case, I would
considering
learning more
about PHP and
store your
articles/blogs
in a database,
and design a
script to fetch
them
dynamically.
|
Viewed: 4,324 Times | |  |
| Viewing Page: 1 of 1 |
|
|
|