本文整理汇总了PHP中Phalcon\Tag::javascriptInclude方法的典型用法代码示例。如果您正苦于以下问题:PHP Tag::javascriptInclude方法的具体用法?PHP Tag::javascriptInclude怎么用?PHP Tag::javascriptInclude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\Tag
的用法示例。
在下文中一共展示了Tag::javascriptInclude方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: outputJs
/**
* Prints the HTML for JS resources
*
* @param string $collectionName the name of the collection
*
* @return string the result of the collection
**/
public function outputJs($collectionName = null)
{
$collection = $this->collection($collectionName);
if ($collection->getJoin()) {
$filename = $collection->getTargetPath();
if (file_exists($filename)) {
$time = 0;
foreach ($collection->getResources() as $resource) {
$tmp = filemtime($resource->getRealTargetPath());
if ($tmp > $time) {
$time = $tmp;
}
}
// If created
if (filemtime($filename) > $time) {
$collection->setTargetUri($collection->getTargetUri() . '?' . filemtime($filename));
return Tag::javascriptInclude($collection->getTargetUri());
}
}
// Else CREATE
$res = parent::outputJs($collectionName);
return $res;
}
return parent::outputJs($collectionName);
}
示例2: registryFunctions
/**
* Registers common function in Twig
*
* @param \Phalcon\Mvc\ViewInterface $view
* @param \Phalcon\DiInterface $di
* @param array $userFunctions
*/
protected function registryFunctions($view, DiInterface $di, $userFunctions = array())
{
$options = array('is_safe' => array('html'));
$functions = array(new \Twig_SimpleFunction('content', function () use($view) {
return $view->getContent();
}, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) {
return $view->partial($partialPath);
}, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) {
return \Phalcon\Tag::linkTo($parameters, $text);
}, $options), new \Twig_SimpleFunction('textField', function ($parameters) {
return \Phalcon\Tag::textField($parameters);
}, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) {
return \Phalcon\Tag::passwordField($parameters);
}, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) {
return \Phalcon\Tag::hiddenField($parameters);
}, $options), new \Twig_SimpleFunction('fileField', function ($parameters) {
return \Phalcon\Tag::fileField($parameters);
}, $options), new \Twig_SimpleFunction('checkField', function ($parameters) {
return \Phalcon\Tag::checkField($parameters);
}, $options), new \Twig_SimpleFunction('radioField', function ($parameters) {
return \Phalcon\Tag::radioField($parameters);
}, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) {
return \Phalcon\Tag::submitButton($parameters);
}, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = array()) {
return \Phalcon\Tag::selectStatic($parameters, $data);
}, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = array()) {
return \Phalcon\Tag::select($parameters, $data);
}, $options), new \Twig_SimpleFunction('textArea', function ($parameters) {
return \Phalcon\Tag::textArea($parameters);
}, $options), new \Twig_SimpleFunction('form', function ($parameters = array()) {
return \Phalcon\Tag::form($parameters);
}, $options), new \Twig_SimpleFunction('endForm', function () {
return \Phalcon\Tag::endForm();
}, $options), new \Twig_SimpleFunction('getTitle', function () {
return \Phalcon\Tag::getTitle();
}, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) {
return \Phalcon\Tag::stylesheetLink($parameters, $local);
}, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) {
return \Phalcon\Tag::javascriptInclude($parameters, $local);
}, $options), new \Twig_SimpleFunction('image', function ($parameters) {
return \Phalcon\Tag::image($parameters);
}, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) {
return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase);
}, $options), new \Twig_SimpleFunction('getDocType', function () {
return \Phalcon\Tag::getDocType();
}, $options), new \Twig_SimpleFunction('getSecurityToken', function () use($di) {
return $di->get("security")->getToken();
}, $options), new \Twig_SimpleFunction('getSecurityTokenKey', function () use($di) {
return $di->get("security")->getTokenKey();
}, $options), new \Twig_SimpleFunction('url', function ($route) use($di) {
return $di->get("url")->get($route);
}, $options));
if (!empty($userFunctions)) {
$functions = array_merge($functions, $userFunctions);
}
foreach ($functions as $function) {
$this->twig->addFunction($function);
}
}
示例3: importResources
/**
* Import CodeMirror resources
*
* @return void
*/
public static function importResources()
{
echo Tag::javascriptInclude('js/codemirror/lib/codemirror.js');
echo Tag::javascriptInclude('js/codemirror/mode/clike/clike.js');
echo Tag::javascriptInclude('js/codemirror/mode/xml/xml.js');
echo Tag::javascriptInclude('js/codemirror/mode/css/css.js');
echo Tag::javascriptInclude('js/codemirror/mode/php/php.js');
echo Tag::javascriptInclude('js/codemirror/lib/codephalcon.js');
echo Tag::stylesheetLink('css/codemirror/codemirror.css');
echo Tag::stylesheetLink('css/codemirror/codephalcon.css');
}
示例4: registryFunctions
/**
* Registers common function in Twig
*
* @param \Phalcon\Mvc\ViewInterface $view
*/
private function registryFunctions($view)
{
$options = array('is_safe' => array('html'));
$functions = array(new \Twig_SimpleFunction('content', function () use($view) {
return $view->getContent();
}, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) {
return $view->partial($partialPath);
}, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) {
return \Phalcon\Tag::linkTo($parameters, $text);
}, $options), new \Twig_SimpleFunction('textField', function ($parameters) {
return \Phalcon\Tag::textField($parameters);
}, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) {
return \Phalcon\Tag::passwordField($parameters);
}, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) {
return \Phalcon\Tag::hiddenField($parameters);
}, $options), new \Twig_SimpleFunction('fileField', function ($parameters) {
return \Phalcon\Tag::fileField($parameters);
}, $options), new \Twig_SimpleFunction('checkField', function ($parameters) {
return \Phalcon\Tag::checkField($parameters);
}, $options), new \Twig_SimpleFunction('radioField', function ($parameters) {
return \Phalcon\Tag::radioField($parameters);
}, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) {
return \Phalcon\Tag::submitButton($parameters);
}, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = []) {
return \Phalcon\Tag::selectStatic($parameters, $data);
}, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = []) {
return \Phalcon\Tag::select($parameters, $data);
}, $options), new \Twig_SimpleFunction('textArea', function ($parameters) {
return \Phalcon\Tag::textArea($parameters);
}, $options), new \Twig_SimpleFunction('form', function ($parameters = []) {
return \Phalcon\Tag::form($parameters);
}, $options), new \Twig_SimpleFunction('endForm', function () {
return \Phalcon\Tag::endForm();
}, $options), new \Twig_SimpleFunction('getTitle', function () {
return \Phalcon\Tag::getTitle();
}, $options), new \Twig_SimpleFunction('getTitle', function () {
return \Phalcon\Tag::getTitle();
}, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) {
return \Phalcon\Tag::stylesheetLink($parameters, $local);
}, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) {
return \Phalcon\Tag::javascriptInclude($parameters, $local);
}, $options), new \Twig_SimpleFunction('image', function ($parameters) {
return \Phalcon\Tag::image($parameters);
}, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) {
return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase);
}, $options), new \Twig_SimpleFunction('getDocType', function () {
return \Phalcon\Tag::getDocType();
}, $options));
foreach ($functions as $function) {
$this->_twig->addFunction($function);
}
}
示例5: importResources
/**
* Import CodeMirror resources
*
* @return void
*/
public static function importResources()
{
echo Tag::stylesheetLink('css/codemirror/ambiance.css');
echo Tag::stylesheetLink('css/codemirror/codemirror.css');
echo Tag::javascriptInclude('js/codemirror/lib/codemirror.js');
echo Tag::javascriptInclude('js/codemirror/addon/edit/matchbrackets.js');
echo Tag::javascriptInclude('js/codemirror/addon/selection/active-line.js');
echo Tag::javascriptInclude('js/codemirror/mode/clike/clike.js');
echo Tag::javascriptInclude('js/codemirror/mode/htmlmixed/htmlmixed.js');
echo Tag::javascriptInclude('js/codemirror/mode/xml/xml.js');
echo Tag::javascriptInclude('js/codemirror/mode/css/css.js');
echo Tag::javascriptInclude('js/codemirror/mode/php/php.js');
echo Tag::javascriptInclude('js/codemirror/lib/codephalcon.js');
echo Tag::stylesheetLink('css/codemirror/codephalcon.css');
}
示例6: outputJs
/**
* Prints the HTML for JS resources.
*
* @param string $collectionName the name of the collection
*
* @return string
**/
public function outputJs($collectionName = self::DEFAULT_COLLECTION_JS)
{
$remote = $this->_config->application->assets->get('remote');
$collection = $this->collection($collectionName);
if (!$remote && $collection->getJoin()) {
$local = $this->_config->application->assets->get('local');
$lifetime = $this->_config->application->assets->get('lifetime', 0);
$filepath = $local . self::GENERATED_STORAGE_PATH . ($filename = $filename = $this->getCollectionFileName($collection, self::FILENAME_PATTERN_JS));
$collection->setTargetPath($filepath)->setTargetUri($filepath);
if ($this->_cache->exists($filename)) {
return Tag::javascriptInclude($collection->getTargetUri());
}
$res = parent::outputJs($collectionName);
$this->_cache->save($filename, true, $lifetime);
return $res;
}
return parent::outputJs($collectionName);
}
示例7: foreach
<?php
foreach ($this->assets->collection('js') as $resource) {
echo \Phalcon\Tag::javascriptInclude($resource->getPath());
}
示例8: javascriptInclude
public static function javascriptInclude($parameters = null, $local = true)
{
return parent::javascriptInclude($parameters, $local);
}
示例9: builderStyle
function builderStyle()
{
echo '<style>
.dropzone-dashboard {
background-color: #ffffff;
min-height: 55px;
float: left;
margin-bottom: 5px;
margin-top: 5px;
opacity: 0.9;
padding: 0;
position: relative;
transition: opacity 200ms ease;
width: 100%;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
transition: all 0.2s ease;
}
.dropzone-dashboard.active {
opacity: 1;
}
.hover {
background: #EEE;
margin:8px;
min-height: 45px;
position: relative;
width: 100%;
-webkit-transition: opacity 0.2s ease;
-moz-transition: opacity 0.2s ease;
-o-transition: opacity 0.2s ease;
-ms-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
}
</style>';
echo '<style>
.dropzone-portlet {
background-color: #ffffff;
min-height: 55px;
float: left;
margin-bottom: 5px;
margin-top: 5px;
opacity: 0.9;
padding: 0;
position: relative;
transition: opacity 200ms ease;
width: 100%;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
-ms-transition: all 0.2s ease;
transition: all 0.2s ease;
}
.dropzone-portlet.active {
opacity: 1;
}
.hover {
background: #EEE;
margin:8px;
min-height: 45px;
position: relative;
width: 100%;
-webkit-transition: opacity 0.2s ease;
-moz-transition: opacity 0.2s ease;
-o-transition: opacity 0.2s ease;
-ms-transition: opacity 0.2s ease;
transition: opacity 0.2s ease;
}
</style>';
echo \Phalcon\Tag::javascriptInclude('assets/global/plugins/jquery-ui/jquery-ui-droppable-iframe-fix.js');
echo \Phalcon\Tag::stylesheetLink("https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css");
}
示例10: testJavascriptIncludeWithStringAsSecondParameterRemoteXHTML
/**
* Tests javascriptInclude with a string as the second parameter - remote link
*
* @author Nikos Dimopoulos <nikos@phalconphp.com>
* @since 2012-10-26
*/
public function testJavascriptIncludeWithStringAsSecondParameterRemoteXHTML()
{
\Phalcon\Tag::setDoctype(\Phalcon\Tag::XHTML10_STRICT);
$options = 'http://my.local.com/js/phalcon.js';
$expected = '<script type="text/javascript" src="http://my.local.com/js/phalcon.js"></script>' . PHP_EOL;
$actual = \Phalcon\Tag::javascriptInclude($options, '0');
\Phalcon\Tag::setDoctype('');
$this->assertEquals($expected, $actual, sprintf($this->message, 'JavascriptInclude remote with string as second parameter'));
}
示例11: testIssue1486
public function testIssue1486()
{
$di = new Phalcon\DI\FactoryDefault();
$di->getshared('url')->setBaseUri('/');
\Phalcon\Tag::setDI($di);
$html = \Phalcon\Tag::stylesheetLink('css/phalcon.css');
$this->assertEquals($html, '<link rel="stylesheet" href="/css/phalcon.css" type="text/css" />' . PHP_EOL);
$html = \Phalcon\Tag::stylesheetLink(array('css/phalcon.css'));
$this->assertEquals($html, '<link rel="stylesheet" href="/css/phalcon.css" type="text/css" />' . PHP_EOL);
$html = \Phalcon\Tag::javascriptInclude('js/phalcon.js');
$this->assertEquals($html, '<script src="/js/phalcon.js" type="text/javascript"></script>' . PHP_EOL);
$html = \Phalcon\Tag::javascriptInclude(array('js/phalcon.js'));
$this->assertEquals($html, '<script src="/js/phalcon.js" type="text/javascript"></script>' . PHP_EOL);
}
示例12: includeModernizr
private function includeModernizr()
{
return Tag::javascriptInclude('js/modernizr-2.8.3.js');
}
示例13: getJs
public function getJs()
{
return Tag::javascriptInclude('https://www.google.com/recaptcha/api.js', false);
}
示例14:
<?php
// Generate <script src="http://localhost/javascript/jquery.min.js" type="text/javascript"></script>
echo \Phalcon\Tag::javascriptInclude("http://localhost/javascript/jquery.min.js", false);
// Generate <script src="/your-app/javascript/jquery.min.js" type="text/javascript"></script>
echo \Phalcon\Tag::javascriptInclude("javascript/jquery.min.js");
示例15: javascriptInclude
public static function javascriptInclude($parameters = null, $local = null)
{
return Tag::javascriptInclude($parameters, $local);
}