<?php

include "./inc/config.inc";
include "../phploader/loader.php";
//Create a custom module metadata set
$customModules = array("customJS" => array("name" => 'customJS', "type" => 'js', "fullpath" => './assets/custom/data.js', "requires" => array("event", "dom", "json")), "customCSS" => array("name" => 'customCSS', "type" => 'css', "fullpath" => './assets/custom/custom.css'));
//Get a new YAHOO_util_Loader instance which includes our custom metadata along with the base YUI metadata
//Note: rand is used here to help cache bust the example
$loader = new YAHOO_util_Loader($yuiCurrentVersion, 'my_custom_config_' . rand(), $customModules);
$loader->load("customJS", "customCSS");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>YUI PHP Loader Utility Example: Adding Custom Modules with YUI Dependencies</title>
	<?php 
echo $loader->css();
?>
</head>
<body>
    <h1>YUI PHP Loader Utility Example: Adding Custom Modules with YUI Dependencies</h1>
    
    <p><a href="http://developer.yahoo.com/yui/phploader/">The YUI PHP Loader Utility</a> is designed, of course, to 
    help you put YUI components on the page.  While the YUI PHP Loader is great at loading YUI resources it is important 
    to point out that it can also be a great resource for loading custom non-YUI JavaScript and CSS resources on the page 
    as well.  These can be mixed in with YUI dependencies and/or be all custom modules.</p>
    
<?php

include "./inc/config.inc";
include "../phploader/loader.php";
$loader = new YAHOO_util_Loader($yuiCurrentVersion);
//Specify YUI components to load
$loader->load("calendar");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>YUI PHP Loader Utility Advanced Example: Loading YUI Calendar with the YUI PHP Loader Utility</title>
	<?php 
//Output the CSS link tags
echo $loader->css();
?>
</head>

<body class="yui-skin-sam">

<h1>YUI PHP Loader Utility Advanced Example: Loading the YUI Calendar Control with the YUI PHP Loader Utility</h1>

<p>In this example, we bring a YUI component onto the page using the <a href="http://developer.yahoo.com/yui/phploader/">YUI PHP Loader Utility</a>. This example implements YUI PHP Loader via a <code>YAHOO_util_Loader</code> instance.  We include the YUI PHP Loader class file, then specify in configuration which component we want loaded on the page &mdash; and what we want to do once it <em>is</em> loaded.  The main difference between this advanced example and the simple one show <a href="./phploader-basic.html">here</a> is that this one outputs the CSS and JavaScript files separately with two different method calls.  The CSS files are included in the document head and the JavaScript files are included just before the closing body node.  This is done in accordance with the best practice performance recommendations outlined <a href="http://developer.yahoo.com/performance/rules.html">here</a>.</p>

<div id="calendar_container"></div>

<?php 
//Output the script tags
echo $loader->script();
?>
<script type="text/javascript">
Exemplo n.º 3
0
    }
    if (isset($_GET["filter"])) {
        $filter = $_GET["filter"];
        $loader->filter = $filter;
    }
    if (isset($_GET["combine"])) {
        $combine = true;
    }
    if (isset($_GET["loadOptional"])) {
        $loadOptional = true;
    }
    $loader->combine = $combine;
    $loader->loadOptional = $loadOptional;
    // tell the loader about each module requested
    foreach ($modules as $module) {
        $loader->load($module);
    }
    $output = $loader->processDependencies($contenttype, $moduletype);
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<title>Yahoo UI Library Loader</title>

<style type="text/css">


    pre {
Exemplo n.º 4
0
<?php

/**
 *  Copyright (c) 2009, Yahoo! Inc. All rights reserved.
 *  Code licensed under the BSD License:
 *  http://developer.yahoo.net/yui/license.html
 *  version: 1.0.0b2
 */
include "../loader.php";
define("YUI_VERSION_TO_TEST", "2.8.0r4");
$loader = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
//Specify YUI components to load
$loader->combine = true;
$loader->comboBase = "http://localhost/phploader/phploader/combo.php?";
//modify as needed
$loader->load("editor", "calendar", "container", "animation", "fonts");
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Calendar Plugin</title>

    <style type="text/css">
    /*margin and padding on body element
      can introduce errors in determining
      element position and are not recommended;
      we turn them off as a foundation for YUI
      CSS treatments. */
    body {
Exemplo n.º 5
0
define("YUI_VERSION_TO_TEST", "2.8.0r4");
function encoded_out($str)
{
    echo htmlentities($str);
}
$customConfig = array("test1" => array("name" => 'test1', "type" => 'js', "path" => 'path/to/file1.js', "requires" => array(0 => 'event', 1 => 'dom'), "optional" => array(0 => 'connection')), "test2" => array("name" => 'test2', "type" => 'js', "path" => 'path/to/file2.js', "requires" => array(0 => 'test1')), "test3" => array("name" => 'test3', "type" => 'js', "path" => 'path/to/file3.js', "global" => true));
// arg1: Unique APC cache key.  This is combined with the YUI base
//       so that updates to YUI will force a new cache entry.
//       However, if your custom config changes, this key should
//       be changed (otherwise the old values will be used until
//       the cache expires --- currently set to 30 minutes).
// arg2: a list of custom modules
// arg3: pass true if you do not want the YUI metadata
$loader = new YAHOO_util_Loader(YUI_VERSION_TO_TEST, 'config_v_2', $customConfig);
// What to load
$loader->load("menu", "animation", "test2");
// Automatically pull in optional dependencies
// $loader->loadOptional = true;
// Specify modules that are already on the page that should not
// be loaded again.
// $loader->setLoaded("event", "dom");
// $loader->setLoaded("yahoo-dom-event"); // bug 1081006
// The base will be combined with the module's 'path' attribute
// to create its URL, unless the module has a 'fullpath' attribute.
// The default is the path to the current YUI version yahooapis
$loader->base = "/build/";
// Configure the base dir for a set of modules.  This overrides
// the global base property
$loader->overrideBase("/otherbasedir/", array("test1", "test2", "test3"));
// No filter is applied by default.  YUI_RAW ("RAW") and YUI_DEBUG
// ("DEBUG") are currently the only valid options.  The former will
Exemplo n.º 6
0
encoded_out("<!-- css -->\n");
encoded_out($l8->css());
encoded_out("<!-- js -->\n");
encoded_out($l8->script());
/* separate css and js output */
//////////////////////////////////////////////////////////////////////////
encoded_out("\n\nTest 9:\n\n");
$l9 = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$l9->load("calendar");
encoded_out($l9->json());
/* json */
//////////////////////////////////////////////////////////////////////////
encoded_out("\n\nTest 10:\n\n");
$l10 = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$l10->load("calendar");
encoded_out($l10->embed());
///////////////////////////////////////////
encoded_out("\n\nTest 11:\n\n");
//$yui_config->configDebug(array(
//"menu" => true
//));
$l11 = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$l11->base = "../../build/";
$l11->filter = YUI_DEBUG;
$l11->load("menu");
encoded_out($l11->tags());
encoded_out($l11->getLoadedModulesAsJSON());
/* embed */
?>

<?php

include "./inc/config.inc";
include "../phploader/loader.php";
//Create a custom module metadata set
$customModules = array("JSONModule" => array("name" => 'JSONModule', "type" => 'js', "fullpath" => 'http://www.json.org/json2.js'), "customJS" => array("name" => 'customJS', "type" => 'js', "fullpath" => './assets/custom/data.js', "requires" => array('JSONModule')), "customCSS" => array("name" => 'customCSS', "type" => 'css', "fullpath" => './assets/custom/custom.css'));
//Get a new YAHOO_util_Loader instance which includes just our custom metadata (No YUI metadata)
//Note: rand is used here to help cache bust the example
$loader = new YAHOO_util_Loader($yuiCurrentVersion, 'my_custom_config_' . rand(), $customModules, true);
$loader->load("JSONModule", "customJS", "customCSS");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>YUI PHP Loader Utility Example: Adding Custom (Non-YUI) Content with YUI PHP Loader</title>
	<?php 
echo $loader->css();
?>
</head>
<body>
    <h1>YUI PHP Loader Utility Example: Adding Custom (Non-YUI) Content with YUI PHP Loader</h1>

    <p><a href="http://developer.yahoo.com/yui/phploader/">The YUI PHP Loader Utility</a> is designed, of course, to 
    help you put YUI components on the page.  While the YUI PHP Loader is great at loading YUI resources it is important 
    to point out that it can also be a great resource for loading custom non-YUI JavaScript and CSS resources on the page 
    as well.  These can be mixed in with YUI dependencies and/or be all custom modules.</p>