Queen's University

Faculty and Staff Banner

Utility Bar PHP Snippet

For those groups who continue to develop their websites by means other than WebPublish (Queen's custom designed content management tool), a "PHP snippet" has been created by the Marketing & Communications Department to facilitate a common web template "utility bar" element featuring: Queen's branding (i.e. wordmark), access to the improved Queen's web search, and a quick access list.

See a live (Option A) PHP example or live (Option B) JavaScript example of the utility bar.

Step 1

Link to the external stylesheet, and javascript files (for IE support) within the <head> </head> tags.  Note that utilitybar.js requires jQuery, which is included in queens_common.js - so if your site already includes jQuery, there's no need for you to include the queens_common.js script.

<link rel="stylesheet" media="screen" type="text/css" href="http://www.queensu.ca/style/css/queensDefault/queens_utilitybar.css"/>
<!--[if lt IE 9]> <link rel="stylesheet" media="screen" type="text/css" href="http://www.queensu.ca/style/css/queensDefault/queens_utilitybar_ie.css"/> <![endif]-->
<!--[if lte IE 9]>
<script src="http://www.queensu.ca/style/javascript/queensDefault/queens_common.js" type="text/javascript"></script>
<script src="http://www.queensu.ca/style/javascript/queensDefault/utilitybar.js" type="text/javascript"></script>
<![endif]-->

Step 2

(Option A) PHP Include for PHP based sites

Place the following PHP snippet into your existing webpage, immediately after the <body> element. Note this is only available for PHP based web sites.

<?php
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL, 'http://www.queensu.ca/resources/php/utilitybar.php');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT, 4);
curl_exec($curl_handle);
curl_close($curl_handle);
?>

Or you can use the following if you do not have cURL available.

<?php print file_get_contents('http://www.queensu.ca/resources/php/utilitybar.php'); ?>

(Option B) JavaScript include for any sites

This option is available for any web sites, those using PHP or any other language including plain HTML. Insert this code right after the <body> tag.

<script src="http://www.queensu.ca/style/javascript/queensDefault/utilitybar.js.php" type="text/javascript"></script>

As we continue to improve and update the queensu.ca site, your site will reflect any changes we make to the utility bar, as long as you include the php snippet and not the straight HTML code.

If you have any questions, please contact the Marketing and Communications Department.