<?php

    $fb = new \Facebook\Facebook([
        'app_id' => $config["fb_settings"]["app_id"],
        'app_secret' => $config["fb_settings"]["client_secret"],
        'default_graph_version' => $config["fb_settings"]["default_graph_version"],
    ]);

    $helper = $fb->getRedirectLoginHelper();

    $permissions = ['public_profile', 'email'];
    $loginUrl = $helper->getLoginUrl($config["fb_settings"]["login_url"], $permissions);
    $smarty->assign('facebook_login_url', htmlspecialchars($loginUrl));