Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorjohnnyc
    • CommentTimeAug 29th 2008
     
    Has anyone tried to integrate AMFPHP and Plogger? If you don't know, AMFPHP allows Flex and Flash to talk to PHP. So, using AMFPHP, I'd be able to get a list of Plogger API functions, send them variables from Flex or Flash, and be returned variables from PHP. Any tips on how I might go about setting this up? Basically interested in trying to make a Flex front-end or theme for Plogger. Thanks!
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 29th 2008
     
    johnnyc,

    I'm not all that familiar with AMFPHP (I hadn't even heard of it 'til you mentioned it), but I just glanced through their website. Does AFMPHP require you to set up a PHP class for it to talk to, or can it connect to an XML connecter API? I'm just wondering because there is already an XML connector written for Plogger (which has been used by some other users to integrate with Flash, see here or do a search for 'Johan:' comments).

    If you could provide some additional info or examples on how AMFPHP interacts with PHP scripts, we could try to help you out.
    • CommentAuthorjohnnyc
    • CommentTimeAug 30th 2008 edited
     
    I stared with plog-xml.php, and here's what I ended up with:

    <code>
    <?php
    // PlogAmf.php
    // Returns Plogger content for an AMF alternative interface.
    // Same as plog-xml.php with GET variable processing and
    // XML generation removed (lines 2-320)
    // Also added wrappers to the funtions that are called
    // from plog-functions.php in plog-xml.php
    require($_SERVER['DOCUMENT_ROOT']."plog-load-config.php");
    //
    class PlogAmf {

    function get_albums($collection_id = null, $sort = "alpha", $order = "DESC") {
    //get_albums is in plog-functions
    $albums = get_albums($collection_id, $sort, $order);
    return $albums;
    }

    function get_collections($sort = "alpha", $order = "DESC") {
    //get_collections is in plog-functions
    $collections = get_collections($sort, $order);
    return $collections;
    }

    function get_comments($picture_id){
    //get_comments is in plog-functions
    $comments = get_comments($picture_id);
    return $comments;
    }

    function get_pictures($album_id, $order = "alpha", $sort = "DESC"){
    //get_pictures is in plog-functions
    $pictures = get_pictures($album_id, $order, $sort);
    return $pictures;
    }

    // Next 3 get by id functions are not availabe in plog-xml, but I thought
    // they would be useful, so I added wrappers for them here

    function get_collection_by_id($id) {
    //get_collection_by_id is in plog-functions
    $collection = get_collection_by_id($id);
    return $collection;
    }

    function get_picture_by_id($id, $album_id = null) {
    //get_picture_by_id is in plog-functions
    $picture = get_picture_by_id($id, $album_id);
    return $picture;
    }

    function get_album_by_id($id) {
    //get_album_by_id is in plog-functions
    $album = get_album_by_id($id);
    return $album;
    }
    </code>

    Rest of the file is the same as plog-xml.php with the addition of the closing brace for the class. The file has to be named the same as the class name, so PlogAmf.php, and placed in the services directory of your AMFPHP install. For me this is plogger/amfphp/services Note that you may have to change the require for the plog-load-config.php to resolve to where ever your plogger is installed.

    One thing that I think you might want to consider is adding get_collection_by_id, get_picture_by_id, and get_album_by_id to the plog-xml.php. The reason is that the plog-xml.php has get_picture_ids, get_album_ids, and get_collection_ids. For example if you wanted to get an individual picture based on an id that you got back from get_picture_ids there's no way to do it without calling get_pictures which gives you all the pictures, and then going through the xml to find the id you were looking for. Just a thought.

    OK, I'm off to go play with Plogger and Flex!