Welcome Guest, Not a member yet? Register   Sign In
Parse.com PHP Help please?
#1

[eluser]Unknown[/eluser]
Hi there,

Im a total newbie to php and CodeIgnitor (I'm a C# developer). However I have been tasked to make a CMS for parse.com which we are using as a backend for our apps. So I made a basic form from this page (https://ellislab.com/codeigniter/user-gu...ml#theform). Which is great and works fine, i am now trying to add the parse php sdk, I have followed the guidelines which has created a vendor file in my application/libraries amongst other things. Now if i call a function with any parse code in it my screen is white blank. Does this suggest that I haven't implemented the sdk properly? Does anyone have a very basic project that has the parse sdk implemented? here is some code, if i comment out the CreateObject function it works fine but if i uncomment i get the white blank screen.

Code:
<?php

use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;

class Form extends CI_Controller {

function index()
{
  $this->load->helper(array('form', 'url'));

  $this->load->library('form_validation');

  $this->form_validation->set_rules('username', 'Username', 'callback_username_check');
  $this->form_validation->set_rules('password', 'Password', 'required');
  $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
  $this->form_validation->set_rules('email', 'Email', 'required|is_unique[users.email]');

  if ($this->form_validation->run() == FALSE)
  {
   $this->load->view('myform');
  }
  else
  {
   $this->load->view('formsuccess');

   $this->CreateObject();
  }
}

  public function CreateObject ()
      {
        $user = new ParseUser();
   $user->set("username", "PHPTESTNAME");
   $user->set("password", "phptestname");
   $user->set("email", "[email protected]");

   try
   {
     $user.signUp();
      // Hooray! Let them use the app now.
   }
   catch (ParseException $ex)
   {
     // Show the error message somewhere and let the user try again.
     echo "Error: " . $ex->getCode() . " " . $ex->getMessage();
   }

      }

public function username_check($str)
{
  if ($str == 'test')
  {
   $this->form_validation->set_message('username_check', 'The %s field can not be the word "test"');
   return FALSE;
  }
  else
  {
   return TRUE;
  }
}
}
?>


Any help would be much appreciated.

Below is a link to a simple codeigniter project with the parse php sdk, if someone could tell me where I'm going wrong that would be great (the parse code is in welcome.php and I've removed my app keys etc so obviously this won't work)

https://www.dropbox.com/sh/rda2m8wm8bs5v...U816_KPJna


Messages In This Thread
Parse.com PHP Help please? - by El Forum - 08-12-2014, 03:49 AM
Parse.com PHP Help please? - by El Forum - 08-12-2014, 02:16 PM
Parse.com PHP Help please? - by El Forum - 08-12-2014, 02:27 PM
Parse.com PHP Help please? - by El Forum - 08-12-2014, 03:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB