Welcome Guest, Not a member yet? Register   Sign In
Integrating AMFPHP and CodeIgniter -- the EASY WAY!
#1

[eluser]Unknown[/eluser]
How to integrate CodeIgniter and AMFPHP

Start a new PHP file

Create a class called AMFPHP_CI_Integration.php in your amfphp/services folder:

Code:
<?php
    class AMFPHP_CI_Integration
    {
    }
?>

Copy the CodeIgniter framework into your amfphp folder

Create the constructor function for the AMFPHP_CI_Integration.php file:

Code:
function AMFPHP_CI_Integration extends Controller
{
}

Create a CI folder in your amfphp/services folder and create a CodeIgniter.php file:
Code:
<?php
    if (!defined('BASEPATH')) define ("BASEPATH", "../CodeIgniter/system/");
    if (!defined('APPPATH')) define ("APPPATH", "../CodeIgniter/system/application/");
    if (!defined ("EXT")) define ("EXT", ".php");

    require_once (BASEPATH."codeigniter/Base5.php");
    require_once (BASEPATH."libraries/Controller.php");
    require_once (BASEPATH."codeigniter/Common.php");
?>

This file basically just includes all the base CI files in your service

Add the following code to your constructor function of the AMFPHP_CI_Integration.php file:

Code:
parent::Controller ();

and the following code to the top of the file, just below the <?php tag:

Code:
require_once ("CI/CodeIgniter.php");

And you're done! Use CodeIgniter in the way you normally would and enjoy!
#2

[eluser]Yash[/eluser]
Why we AMFPHP? I mean what is this?
#3

[eluser]Unknown[/eluser]
www.amfphp.org
#4

[eluser]andreagam[/eluser]
Nice, Danny! I think I'll test it soon.
Thanks for your contribution...
#5

[eluser]Chris Newton[/eluser]
AMFPHP is a method to provide database/server services connectivity to Flash. It's something that can be used in place of FLEX or Flash Remoting. Last time I used it it didn't seem that simple to implement (seemed like a lot of code duplication) but I was a crappier developer back then, so... YMMV.

We usually pull XML feeds via PHP to get dynamic data into flash, or avoid flash altogether if the app needs tightly integrated server services. Not that our methods are the best way, but most of the time I've found using flash as an application tool is somewhat needless, if your main aim isn't to do tons of animation while in the application. And this is coming from a guy that runs a company that makes it's money doing flash animation.

Sorry for being a bit off-topic. I appreciate the efforts of course to get AMFPHP integrated with CI. That's always welcome.
#6

[eluser]vevmesteren[/eluser]
More thinking out loud...
I have for some time now been waiting for an includable library, of amfphp in CI. In the meantime I have been using a self-made solution, that allows me to use AMFPHP and CI together. Well actually, not together, but next to each other, allowing the former to use some of the latter's functionalities.

I think patch-solutions like this one (which I find to look promising).But it is still AMFPHP being plugged into, or flimsily linked to CI. As to the XML vs Remoting debate within Flash, I find that it really depends on the amount of data that is to be shipped to Flash. I have had great success with serializing Datasets and un-serializing them when the user requests them as opposed to querying the DB every time. But now I am REALLY off topic Smile

Really my point being is there a library in the pipes?

have not been able to get this one: http://codeigniter.com/wiki/Amfphp_and_CI/ to work at all...anyone got a zipped archive with the described solution working and online somewhere?

thanks

V
#7

[eluser]philpalmieri[/eluser]
Hi V: http://codeigniter.com/wiki/AMF_Codeigni...ooks_Etc./
#8

[eluser]yonel[/eluser]
hello everybody!!!!

i did the implementation of AMFPHP and CI but now i know how to do to make flash and php exchange.
Do you have a little example of codeigniter amfphp application with flash??

excuse for my poor English
#9

[eluser]Unknown[/eluser]
Hello and thanx for this post. It worked fine for me - using it as a library only - but I can't figure out how it works with the new Version 2.0.

Anybody have any idea ?

Cheerio,
Ray
#10

[eluser]Sixer[/eluser]
MilkyRay: In CI 2.0, the workings of Controllers have slightly changed. Therefore you need to change, in application/controllers/amf_gateway.php:
Code:
<?php
class Amf_gateway extends Controller
{
  public function __construct()
  {
    parent::Controller();


To:

Code:
<?php
class Amf_gateway extends CI_Controller
{
  public function __construct()
  {
    parent::__construct();

Also, remember that application/ no longer resides in system/ with CodeIgniter 2.0.




Theme © iAndrew 2016 - Forum software by © MyBB