Forums

Json php in a page (5 posts)

  1. lassechor
    Member
    Posted 1 year ago #

    Hi all,

    I'm trying to make this json code run in a normal page.. Does not work.. Do you know how to do it?

    <?php
    $json_url ="https://graph.facebook.com/6665038402";
    $json = file_get_contents($json_url);
    $json_output = json_decode($json);
    $likes = 0;
    if($json_output->likes){
    	$likes = $json_output->likes;
    }
    echo '?=','Total likes: '.$likes;
    ?>
    </p>

    [Please post code snippets between backticks or use the code button.]

  2. lassechor
    Member
    Posted 1 year ago #

    It just shows the code when I publish it..

  3. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

  4. lassechor
    Member
    Posted 1 year ago #

    I can't really find the part on json? Can you help me?

  5. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Try adding your code to a page template - not the page content.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags