Skip to:
Content
Pages
Categories
Search
Top
Bottom

Json api to groups page


  • jabbajabba
    Participant

    @jabbajabba

    Hi, would be nice someone could help me.
    I’m trying to display some json data on a groups page,
    But all i get is the php code printed out.(I’m not a programmer :))

    This is what i use:
    <?php
    function jabbajabbab() {
    ?>
    $url = ‘http://some-site.com:1359/api/groups/jabbajabba’;
    $content = file_get_contents($url);
    $json = json_decode($content, true);

    foreach($json[‘some_data’] as $item) {
    print $item[‘registration_date’];
    print ‘some text’;
    <?php
    }
    add_action( ‘bp_before_group_header_meta’, ‘jabbajabbab’ );
    ?>

    i have that in my bp-custom.php

    i have that in my bp-custom.php

Viewing 3 replies - 1 through 3 (of 3 total)

  • shanebp
    Moderator

    @shanebp

    Please use the ‘code’ tag when sharing code.
    Even better – use pastebin.com

    try: http://pastebin.com/c0EzurRT

    But you would, the code block in the centre isn’t JS it’s PHP and you have escaped out of PHP parsing so it will be treated as cdata.

    Why are you thinking you need to use json functions?

    Perhaps explaining exactly what your trying to achieve might prompt someone to suggest a better approach which there almost certainly is.


    jabbajabba
    Participant

    @jabbajabba

    Please use the ‘code’ tag when sharing code.
    Even better – use pastebin.com

    try: http://pastebin.com/c0EzurRT


    @shanebp
    right, i should do that next time.

    @hnla
    the data is from a partner website which is only provided via json

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Json api to groups page’ is closed to new replies.
Skip to toolbar