+ Reply to Thread
Results 1 to 5 of 5

Thread: Php Comment system

  1. #1
    Ainokea is offline x10 Sophmore Ainokea is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    127

    Php Comment system

    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.

  2. #2
    TheMan177 is offline x10 Sophmore TheMan177 is an unknown quantity at this point
    Join Date
    Jan 2008
    Posts
    179

    Re: Php Comment system

    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.

  3. #3
    Ainokea is offline x10 Sophmore Ainokea is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    127

    Re: Php Comment system

    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 by Ainokea; 09-26-2008 at 01:45 AM.

  4. #4
    Zippoh is offline x10Hosting Member Zippoh is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    14

    Re: Php Comment system

    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.

  5. #5
    Ainokea is offline x10 Sophmore Ainokea is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    127

    Re: Php Comment system

    well still does any one have any idea how I can obtain directorys?

+ Reply to Thread

Similar Threads

  1. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  2. CRON Jobs and PHP
    By deadimp in forum Tutorials
    Replies: 14
    Last Post: 11-27-2008, 05:09 PM
  3. The Best Stable PHP Content management system
    By medphoenix in forum Crossfire
    Replies: 0
    Last Post: 02-01-2008, 01:06 PM
  4. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers