Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>Q. Create a controller with the functions of utilsFacebook is the correct think to do?</p> </blockquote> <p>Having done a facebook app using yii as the framework, i would recommend you to make this library either a component, or an extension.</p> <p>But definitely <strong>don't</strong> put these functions in the controller directly. Whenever a controller needs them call the functions using your custom facebook util class.</p> <p>Components can be put in the folder: <em>projectrootfolder/protected/components</em></p> <p>Extensions can be put in the folder: <em>projectrootfolder/protected/extensions</em></p> <p>If you don't believe that either of these make semantic sense, you can always create a new folder within <em>protected</em>, say <em>utils</em> and put the class there. However i think extensions is the best way to go.</p> <blockquote> <p>Q. Should I store that object in a SESSION to get a better performance or is a bad idea?</p> </blockquote> <p>I don't think it's necessary to store the object in a session, because there will be no visible performance gain. Further you'll complicate your code unnecessarily.</p> <p>What i had done was, created an app level component and used this component throughout the app, in any controller.</p> <p>Example:</p> <p>In your application's config, <em>protected/config/main.php</em> :</p> <pre><code>'components'=&gt;array( 'fbHelper'=&gt;array( // gave the component this name 'class'=&gt;'ext.utils.FacebookHelper', // had stored the helper class in extensions/utils folder 'parameter1'='somevalue', // more parameters ), // standard yii app components ), </code></pre> <p>This will allow you to use the component like this: <code>Yii::app()-&gt;fbHelper-&gt;getFriends();</code></p> <p>Take a look at the <a href="http://www.yiiframework.com/extension/facebook-opengraph" rel="nofollow" title="http://www.yiiframework.com/extension/facebook-opengraph">facebook-opengraph</a> extension, which could help you, on the way.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload