Zend添加了类似facebook的内容


Zend adding facebook like

如何在基于zend的应用程序中添加类似facebook的功能?代码是放在视图中还是放在助手中?

facebook.app_id = "APPID"
facebook.app_secret = "SECRET"

感谢

在zend中添加类似facebook的最简单方法是在helpers中添加代码,稍后可以从视图中调用。

class Application_View_Helper_GetFacebookLikeBox extends Zend_View_Helper_Abstract
{
public function getFacebookLikeBox()
{
    $config = Zend_Registry::get('config');
    $app_id = $config['facebook']['app_id'];
    return '<iframe
                src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2FEXAMPLE&amp;
                    width=250&amp;height=284&amp;colorscheme=light&amp;show_faces=true&amp;border_color&amp;
                    stream=false&amp;header=false&amp;appId='.$app_id.'"
                scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:250px; height:284px;"
                allowTransparency="true">
            </iframe>';
}
}

然后从视图中调用$this->getFacebookLike();将呈现类似facebook的按钮。