示例#1
0
文件: test.php 项目: runt18/phploader
encoded_out("\n\nTest 7:\n\n");
$l7 = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$l7->load('editor');
$l7->skin['overrides']['button'] = array('skin1', 'skin2', 'skin3');
encoded_out($l7->tags());
/* The loader can be configured to support more than just javascript files.  */
//////////////////////////////////////////////////////////////////////////
encoded_out("\n\nTest 8:\n\n");
$l8 = new YAHOO_util_Loader(YUI_VERSION_TO_TEST);
$l8->load("treeview");
$l8->load("treeviewcss");
$l8->setLoaded("treeview");
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(
<!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">
    YAHOO.util.Event.onAvailable("calendar_container", function() {
		var myCal = new YAHOO.widget.Calendar("mycal_id", "calendar_container");
		myCal.render();
	})
</script>
</body>
</html>
示例#3
0
文件: json.php 项目: runt18/phploader
    // target is "PE_DEV" or "PE_PROD" for makeover or akamai respectively
    if (isset($_REQUEST["target"])) {
        $target = $_REQUEST["target"];
    }
    // set the target (dev or prod)
    $loader->target = $target;
    // tell the loader about each module requested
    foreach ($modules as $module) {
        $loader->load($module);
    }
    // get the output
    if ($moduletype == "css") {
        $output = $loader->css();
    } else {
        if ($moduletype == "script") {
            $output = $loader->script();
        } else {
            //$output = $loader -> tags();
            //$output .= "<br>\n";
            //$output .= $loader -> getLoadedModulesAsJSON();
            $output = $loader->json();
        }
    }
}
?>
<!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>