Hallo.

Ich habe die Facebook Likebox in meine Seite eingebunden, jedoch hat dies einen negativen Effekt auf die Geschwindigkeit ...

Daher habe ich ein bisschen gegoogelt und bin auf folgenden Artikel gestoßen:
http://aaronsaray.com/blog/2010/04/2...by-caching-it/

Weiters habe ich auch eine Erweiterung für Wordpress gefunden, welche diese Funktion beeinhaltet.

http://wordpress.org/extend/plugins/...fan-box-cache/

Nun würde ich so ein Modul für meine Seite benötigen. Daher hab ich es mal selbst versucht. Als Basis habe ich die Erweiterung xFacebook aus dem ER verwendet. Ich habe die Klasse im Modul angepasst, jedoch nur mit mäßigen Erfolg. Der Stream sowie der Gefällt mir Button funktionieren nicht.

hier ist die Klasse, welche ich angepasst habe:

Code:
class XFacebook extends Module {

    /**
     * Template
     * @var string
     */
    //protected $strTemplate = 'view_xfacebook';	
	protected $strTemplate = 'fanbox';	
	protected $_html, $_fanCount = 0, $_fans = array(), $_pageInfo, $_output;
    /**
     * Generate module
     */
    protected function compile() {

        //Werte aus Datenbank holen
        $objFACE = $this->Database->prepare("SELECT xfacebook_id,xfacebook_with,xfacebook_stream,xfacebook_friends,xfacebook_header,xfacebook_height FROM tl_module WHERE id=?")->execute($this->id);
        while ($objFACE->next()) {
			$this->facebookid = $objFACE->xfacebook_id;
            $this->facebookwidth = $objFACE->xfacebook_with;
            $this->facebookstream = $objFACE->xfacebook_stream;
            $this->facebookfriends = $objFACE->xfacebook_friends;
            $this->facebookheight = $objFACE->xfacebook_height;
            $this->facebookheader = $objFACE->xfacebook_header;
        }

	//url erstellen
	$fanbox_temp_url = 'http://www.facebook.com/plugins/fan.php?connections=';
	$fanbox_temp_url .= $this->facebookfriends;
	$fanbox_temp_url .= '&id=';
	$fanbox_temp_url .= $this->facebookid;
	$fanbox_temp_url .= '&locale=de_DE&stream=';
	$fanbox_temp_url .= $this->facebookstream;
	$fanbox_temp_url .= '&width=';
	$fanbox_temp_url .= $this->facebookwidth;
	$fanbox_temp_url .= '&height=';
	$fanbox_temp_url .= $this->facebookheight;
	$fanbox_url = $fanbox_temp_url;
	//echo $fanbox_url;

	//get Data 
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
        curl_setopt($ch, CURLOPT_URL, $fanbox_url);
        curl_setopt($ch, CURLOPT_FAILONERROR, false); // if 400+, error out - don't want this
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $this->_html = curl_exec($ch);
		
        if ($this->_html === false) {
            throw new exception(curl_errno($ch) . ': ' . curl_error($ch));
        }
        
	curl_close($ch);
		
        /**
         * write out to temp cache to review
         */
        $file = 'templates/fanbox.tpl';
	file_put_contents($file, $this->_html);
	
	//Inhalt von _html ausgeben (Testweise)
	$this->Template->_html;	
    }
}