Re: Building Facebook app on CakePHP

2007-08-09 Thread Sav

Here is an initial start of a Facebook component in CakePHP...
http://savarino.net/facebook-cakephp

Please let me know if there are ways to improve this.

On Aug 4, 8:17 am, thequietlab <[EMAIL PROTECTED]> wrote:
> Hi,
>
> yes, the article gave me a good point to start but I would like to
> hear if any of you has some stories to tell about building in cakephp
> forfacebook.. any pitfalls, things to avoid, good practices ?
>
> For now I have a working beta of my app and I'm just wondering how
> should I sneak there withfacebookstuff.. I think the clean way would
> be to have totally separate app with it's own models, controllers and
> views.. maybe somehow just sharing models with the main app ?
>
> Mandy, do you have a separate app forfacebookor you just mix in 
> thefacebookpart inside your existing controllers/views etc ?
>
> Thanks,
> Andrzej
>
> On Aug 4, 10:48 am, "Mandy Singh" <[EMAIL PROTECTED]> wrote:
>
> > This is built using cakePHP. Thats the relevance of posting the URL here.
>
> > And so iswww.votigo.comwhichis already showcased here.
>
> > And this is thefacebookapp part of that site.
>
> > Any other questions? :)
>
> > Thanks,
> > Mandy.
>
> > p.s. No the source code is not available since its specific to an
> > organization, but if you require help from me that is surely available.
>
> > On 8/4/07, Dr. Tarique Sani <[EMAIL PROTECTED]> wrote:
>
> > > On 8/4/07, Mandy <[EMAIL PROTECTED]> wrote:
>
> > > >http://apps.facebook.com/votigofbapp
>
> > > Is this built in cake? Is the source code available?
>
> > > What is the relevance of posting this URL here
>
> > > T
>
> > > --
> > > =
> > > Cheesecake-Photoblog:http://cheesecake-photoblog.org
> > > PHP for E-Biz:http://sanisoft.com
> > > =


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Building Facebook app on CakePHP

2007-08-08 Thread Sav

Yeah, I'm struggling with the same issue.  It isn't clear as to the
best method for integrating CakePHP and the Facebook API.  This is as
far as I've gotten, and I don't think it is the best way because it
gives you access to the $facebook variable in the view and not the
other controller methods.

Since I'm building a Facebook app with no need for a www version, I'd
like access to the $facebook variable everywhere.  Any ideas?...

vendor('facebook/facebook');
class ContentController extends AppController
{
// NAME
var $name = 'Content';

// VALIDATE
var $validate = array(
'title'  => 'VALID_NOT_EMPTY',
'body'   => 'VALID_NOT_EMPTY'
);

function beforeFilter()
{
// FACEBOOK
$GLOBALS['facebook_config']['debug'] = NULL;
$api_key = "xxx";
$secret = "xxx";
$facebook = new Facebook($api_key, $secret);
$this->set('facebook', $facebook);
}

...
}





On Aug 3, 10:40 am, thequietlab <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm curious if there exists anything similar to rfacebook (http://
> rfacebook.rubyforge.org/) for cakephp ?
>
> I'm starting to build facebook port for my cake application, does
> anyone have any experience with making this combination work ?
>
> I found this little article 
> :http://www.zenperfect.com/2007/07/24/facebook-api-with-cakephp/
> but nothing more.
>
> Best,
> Andrzej


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Validate hasOne?

2007-03-29 Thread Sav

I'm new to CakePHP and I have a basic validation question.

I have a User model and it hasOne Email model:

class User extends AppModel {
  var $name = 'User';
  var $hasOne = array('Email' =>
array('className'=> 'Email',
  'conditions'   => '',
  'order'=> '',
  'dependent'=>  true,
  'foreignKey'   => 'emailId'
)
  );
  // more model code...
}


The User's edit.thml view has this form item:

Email:
inputTag('Email/address',
array('size'=>'40','maxlength'=>'255')); ?>
Email
tagErrorMsg('Email/address', 'Email must be
unique'); ?>


So in my User controller, I'm trying to invalidate duplicate emails
like this:

if (!empty($this->data)) {
  // before checking address is unique, check to see if address is
unchanged
  if ($this->data['Email']['address'] != $this->params['data']['User']
['userOriginalEmail']) {
if ($this->User->Email->find(array("address" => $this-
>data['Email']['address']))) {

  // this is not working !?!?!?
  $this->User->invalidate('Email/address');
  $this->User->Email->invalidate('address');

} else {
  $this->User->Email->save($this->data);
}
  }
  if ($this->User->save($this->data)) {
$this->flash('User has been updated.','/user');
  }
}

Yes, I know my database names are not following the convention, but
I'm trying to use Cake within an existing system.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---