1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.1 how can i add an API key to Xenforo

Discussion in 'XenForo Questions and Support' started by Lawless Baron, Jan 25, 2012.

  1. Lawless Baron

    Lawless Baron Member

    I was wondering how would i go about adding an API to Xenforo
    i want to add the Battlefield 3 stats API
    http://bf3stats.com/api
    located there please help me :)
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    They have example PHP code here:

    http://bf3stats.com/docs/bf3apiexample.php.txt

    I recommend the following approach:

    1) Create an addon in XF.

    2) Create a cron for the addon. The cron will contain the example code to fetch the BF3 information. It will then store the information in the database somewhere. The cron will run at regular intervals to update the information.

    3) Create a template_hook listener to query the stored information and display it in the sidebar or where ever you want.

    This requires coding ability.
     
    ragtek likes this.
  3. ragtek

    ragtek Guest

    Agree:)

    And i would recommand to store the data in the dataregistry
    PHP:
    /**
     * Model that represents data in the data registry system. This system
     * is a generally permanent cache of data that can be read from the
     * cache system or out of the database.
     *
     * Data stored here will be automatically serialized and unserialized
     * as it is retrieved.
     *
     * @package XenForo_Core
     */
    class XenForo_Model_DataRegistry extends XenForo_Model
     
  4. Lawless Baron

    Lawless Baron Member

    Im not a great coder so i cant do that :(
     

Share This Page