Plogger Support Forum - AMFPHP Integration? Fri, 29 Mar 2024 09:04:18 +0000 http://www.plogger.org/forum/ Lussumo Vanilla 1.1.10 AMFPHP Integration? http://www.plogger.org/forum/comments.php?DiscussionID=2136&Focus=8544#Comment_8544 http://www.plogger.org/forum/comments.php?DiscussionID=2136&Focus=8544#Comment_8544 Fri, 29 Aug 2008 01:49:29 +0000 johnnyc AMFPHP Integration? http://www.plogger.org/forum/comments.php?DiscussionID=2136&Focus=8546#Comment_8546 http://www.plogger.org/forum/comments.php?DiscussionID=2136&Focus=8546#Comment_8546 Fri, 29 Aug 2008 12:49:15 +0000 sidtheduck
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.]]>
AMFPHP Integration? http://www.plogger.org/forum/comments.php?DiscussionID=2136&Focus=8574#Comment_8574 http://www.plogger.org/forum/comments.php?DiscussionID=2136&Focus=8574#Comment_8574 Sat, 30 Aug 2008 13:02:34 +0000 johnnyc
<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!]]>