Php Comment system

Ainokea

New Member
Messages
127
Reaction score
0
Points
0
Hi I'm sort of an amateur at php and coding but I know enough to get around. I was thinking how I could make a comment system for my site, each comment log would be unique to its page... etc...

I can get the posting part and reading it but I want to know how I could make it dynamic and work for each article....

like article a draws comments from table a, row 1

how would i do it so I dont need to put this manually for each file.
 

TheMan177

New Member
Messages
179
Reaction score
0
Points
0
Assuming your articles have a unique id field or similar in the database, your comment entries could include a field specifying the article id that it belongs to. When viewing, for example, the article with an id of 1, you search the particular field in the comments table for all comments that belong to article 1.
 

Ainokea

New Member
Messages
127
Reaction score
0
Points
0
hmm I see that would be a much better idea... thanks

I have one more question though I was trying to make a php script to update my sitemap

<?php
$path = "../";
$dir = opendir($path);
$x=0;
while($a = readdir($dir))
{
if(ereg('.html',$a) or ereg('.php',$a))
{
$files[$x]=$a;
$x++;
}

}
$myfile="../Sitemap.xml";
$write = fopen($myfile,'w') or die("unable to open");
fwrite($write,'<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
$n = "\n";
$timestamp = date("Y/m/d");
for($y=0; $y < sizeof($files); $y++)
{

//\n
$string = "<url><loc>http://www.lyfe.pcriot.com/".$files[$y]."</loc>\n";
fwrite($write,$string);
fwrite($write,'<lastmod>'.$timestamp.'</lastmod>'.$n);
fwrite($write,'<changefreq>weekly</changefreq><priority>0.5</priority></url>');
echo "file: ".$files[$y]."<br>";
}

fwrite($write,'</urlset>\n');
something like that... I just wanted more or less pseudocode and get down the basics first then go in add like a gui, with history settings. That auto updates for new pages it detects in a directory...

which would look like this but any ideas how to get the specific path? and how to add line breaks in xml... I tried \n
 
Last edited:

Zippoh

New Member
Messages
14
Reaction score
0
Points
0
AFAIK you don't need the linebreaks in sitemaps, they work perfectly fine without them. And they load fast without linebreaks and indents, if only a little.
 

Ainokea

New Member
Messages
127
Reaction score
0
Points
0
well still does any one have any idea how I can obtain directorys?
 
Top