• The Night Fox

    (@the-night-fox)


    Ok so I’m trying to simply add some code to the Google news plugin so that all the results are nofollowed. I located the code where rel=”nofollow” needs to be inserted, but my poor knowledge oh php means that no matter what I do I get an error!

    $result .= "<li>$description</li>";
                    } else {
                            $result .= "<li><a href=\"$link\" target=\"_blank\" ".
                                       "title=\"$tooltip\" "rel=\"nofollow\">$title<br>$related[1]</a></li>";
                    }
                }
                return $result.'</ul>';
            }

    I always get the error: Parse error: syntax error, unexpected T_STRING in /filepath/wp-content/plugins/google-news/google_news.php on line 747

    Can anyone help me fix this fairly simple problem?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter The Night Fox

    (@the-night-fox)

    I have tried every possible permutation I can think of, but I keep getting the error. Any suggestions?

    yoozoo

    (@yoozoo)

    Hey, I may have a suggestion or two.

    Did you check line 747 to see which string is having trouble being parsed? I checked the unedited php and line 747 turns out to be:

    $result .= "<li><a href=\"$link\" target=\"_blank\" ".

    That string looks fine, as it is no different than the original, unedited code.

    However, line 747 in your php might vary from the unedited version. Especially because of a discrepancy in that the unedited php is arranged a bit differently than what you have posted (disregarding the addition of the nofollow value).

    $link = $item['link'];
                    if ( strlen($desctype) ) {
    
                         .= "<li>$description</li>";
                    } else {
                            $result .= "<li><a href=\"$link\" target=\"_blank\" ".
                                       "title=\"$tooltip\">$title<br />$related[1]</a></li>";
                    }
                }
                return $result.'</ul>';
            }

    Therein might lie the problem.

    I also noticed in your code

    "title=\"$tooltip\" "rel=\"nofollow\">$title<br>$related[1]</a></li>";

    that there are seven quotation marks. You should try removing the ” before rel=

    Finding what string is on line 747 for you will help figure out why you’re getting the error. Let me know what you find. I’ll check in to see if I can help.

    Thread Starter The Night Fox

    (@the-night-fox)

    Hi yoozoo, thanks for the help!

    You were right about there being too many quotation marks, as soon as I removed the quotation before rel everything was solved! I feel a little bit silly now for failing to notice it myself!

    Thanks again,

    TNF

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can an PHP experts help?’ is closed to new replies.