Php undefined error

Discussion in 'PHP' started by Johnburk, Sep 13, 2010.

  1. #1
    I am using the following code in a html and it works fine.

    <?php
    echo '<a href="http://www.website.com">';
    echo file_get_contents( "http://www.website.com/file.php");
    echo '</a>';
    ?>
    PHP:
    Yet when I put it in wordpress with php enabled I get:

    <?php echo=undefined '=undefined href="http://www.website.com"?>
    '; echo file_get_contents( "http://www.website.com/file.php"); echo '
    '; ?>
    Code (markup):
    Does anyone know what I am doing wrong?
     
    Johnburk, Sep 13, 2010 IP
  2. HellBomb

    HellBomb Active Member

    Messages:
    125
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    80
    #2
    Try This perhaps?
    <?php
    echo "<a href='http://www.website.com'>";
    echo file_get_contents('http://www.website.com/file.php');
    echo "</a>";
    ?>
     
    HellBomb, Sep 13, 2010 IP
  3. Johnburk

    Johnburk Peon

    Messages:
    777
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you, but I still get the same error. I think it just how wordpress handles php.
     
    Johnburk, Sep 14, 2010 IP
  4. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #4
    Are you trying to put this into a post ?
     
    MyVodaFone, Sep 14, 2010 IP
  5. Johnburk

    Johnburk Peon

    Messages:
    777
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #5
    No in a sidebar. But I think wordpress just doesn't allow it and it needs an additional sidebar php plugin.
     
    Johnburk, Sep 14, 2010 IP