Html::script PHP Method

script() static public method

Returns one or many script tags depending on the number of scripts given.
static public script ( $url ) : String
$url String of javascript file to include
return String of script tags
    static function script($url)
    {
        return sprintf('<script type="text/javascript" src="%1$s"></script>', $url);
    }

Usage Example

Example #1
1
function header_html($etape)
{
    // Send UTF8 Headers
    header("Content-Type: text/html; charset=UTF-8");
    echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'\n          'http://www.w3.org/TR/html4/loose.dtd'>";
    echo "<html>";
    echo "<head>";
    echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>";
    echo "<meta http-equiv='Content-Script-Type' content='text/javascript'> ";
    echo "<meta http-equiv='Content-Style-Type' content='text/css'> ";
    echo "<meta http-equiv='Content-Language' content='fr'> ";
    echo "<meta name='generator' content=''>";
    echo "<meta name='DC.Language' content='fr' scheme='RFC1766'>";
    echo "<title>Setup GLPI</title>";
    // LIBS
    echo Html::script("../lib/jquery/js/jquery-1.10.2.min.js");
    echo Html::script("../lib/jqueryplugins/select2/select2.min.js");
    echo Html::css("../lib/jqueryplugins/select2/select2.css");
    // CSS
    echo "<link rel='stylesheet' href='../css/style_install.css' type='text/css' media='screen'>";
    echo "</head>";
    echo "<body>";
    echo "<div id='principal'>";
    echo "<div id='bloc'>";
    echo "<div id='logo_bloc'></div>";
    echo "<h2>GLPI SETUP</h2>";
    echo "<br><h3>" . $etape . "</h3>";
}
All Usage Examples Of Html::script
Html