title: Facebook authentication using php sdk and Yii framework
body: <p>I am developing a facebook app using the Yii framework and want to use php sdk for authentication and other graph api calls. Though i have a tested script for authentication which works perfectly, i am not being able to implement it properly with my Yii framework generated files.</p>
  
  <p>Right now i am making a <strong>FacebookHelper</strong> class in <em>components</em> with the whole authentication code in a </p>
  
  <pre><code>    public function authenticator()
  </code></pre>
  
  <p>(have included facebook.php just before this function starts as well as imported using </p>
  
  <pre><code>'application.lib.*'
  </code></pre>
  
  <p>where the lib directory under protected is where my php sdk situated)</p>
  
  <p>and the main controller which is the <strong>SiteController</strong> contains the following code for calling it.</p>
  
  <pre><code>public function actionIndex()
  {
  $fbhelper = new FacebookHelper();
  $value=$fbhelper-&gt;authenticator();
  if($value==0){
        die("It works");
      }
      $this-&gt;render('index');
  }
  </code></pre>
  
  <p>The application calls the login url using the</p>
  
  <pre><code>$facebook-&gt;getLoginUrl()
  </code></pre>
  
  <p>but facebook displays a msg that some error occured.</p>
  
  <p>What am i doing wrong.</p>
  
  <p>As i am new to the MVC model and Yii framework i am a little lost about how should i go about it, so it will be very much appreciated if you can also explain your answer(i.e. if there is some concept regarding the MVC architecture in it). Thankyou!</p>