Articles and titles keep changing

Discussion in 'PHP' started by dutch1, Apr 13, 2008.

  1. #1
    I am new to PHP. I purchased a webpage that when I click an article title link, an article will come up, but it may not be the article that matches the title. When I go back to the article title, the title link has been replaced by another title link. When you click on that link, you may get the same article or a different one.

    What do I need to do to so that the article links stay put and the articles match the article titles??
     
    dutch1, Apr 13, 2008 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,901
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    You really need to look at the code that is generating the html page.

    It sounds as if it's got the record ids all mucked up.
     
    sarahk, Apr 13, 2008 IP
  3. dutch1

    dutch1 Peon

    Messages:
    357
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, I'll check
     
    dutch1, Apr 13, 2008 IP
  4. dutch1

    dutch1 Peon

    Messages:
    357
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm not sure what you mean by "You really need to look at the code that is generating the html page."
    This all looks like PHP to me
     
    dutch1, Apr 24, 2008 IP
  5. sarahk

    sarahk iTamer Staff

    Messages:
    28,901
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #5
    Yep, but that PHP is up to something and if you paste the relevant code in here we can let you know what is going on.
     
    sarahk, Apr 24, 2008 IP
    dutch1 likes this.
  6. dutch1

    dutch1 Peon

    Messages:
    357
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for the clarification Sarah. I misunderstood what you meant. I will get back to you with the relevant code on Monday or Tuesday. I don't have access to all of my files here. I work 4 hours from home, so I am only home a couple of days a week.
     
    dutch1, Apr 26, 2008 IP
  7. dutch1

    dutch1 Peon

    Messages:
    357
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I think this is the code that is controlling the article rotation.

    $num_links_files = 3;
    $dir_kw = "../";
    $dir_links = $dir_kw."links/";
    $dir_articles = $dir_kw."includes/articles/";
    
    if (isset($_POST['newkeywords'])) {
        if (isset($_SESSION['token']) && isset($_POST['token']) && $_POST['token'] == $_SESSION['token']) {
    
            function write_keyword_file($kwdir, $keyword, $article) {
                $keyword = preg_replace('/ /', '-', $keyword);
                $filename = $kwdir.$keyword.".php";
                if($handle = fopen($filename, 'w')) {
                    if($keyword == "index") {
                        $content = '<?php $keyword=$mainkeyword;'."\n";
                    } else {
                        $content = '<?php $keyword="'.$keyword."\";\n";
                    }
                    $content .= "\t".'$pagetype="contentpage";'."\n";
                    if($article != '# random article #') {
                        $content .= "\t".'$static_article="'.$article."\";\n";
                    }
                    $content .= "\t".'include("includes/pages.php"); ?>'."\n";
                    if(fwrite($handle, $content) === FALSE) {
                        echo "WARNING: Cannot write to file ($filename)";
    PHP:
    I need the articles to match the title links.
     
    dutch1, Apr 27, 2008 IP
  8. dutch1

    dutch1 Peon

    Messages:
    357
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Sarah - The changes didn't seem to do anything. The articles are still appear randomly.
     
    dutch1, Apr 29, 2008 IP
  9. dutch1

    dutch1 Peon

    Messages:
    357
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thanks for your help. Problem has been resolved.
     
    dutch1, May 4, 2008 IP