本文整理汇总了PHP中HtmlHelper::css方法的典型用法代码示例。如果您正苦于以下问题:PHP HtmlHelper::css方法的具体用法?PHP HtmlHelper::css怎么用?PHP HtmlHelper::css使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlHelper
的用法示例。
在下文中一共展示了HtmlHelper::css方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootstrapCss
public function bootstrapCss($url = 'bootstrap.min.css', $rel = null, $options = array())
{
$pluginRoot = dirname(dirname(DIRNAME(__FILE__)));
$pluginName = end(explode(DS, $pluginRoot));
$url = '/' . Inflector::underscore($pluginName) . '/css/' . $url;
return parent::css($url, $rel, $options);
}
示例2: _addScripts
/**
* _addScripts method
*
* Adds properties
*
* @param mixed $view
* @return boolean
*/
public function _addScripts($view)
{
if ($this->request->params['plugin'] == 'lil_invoices') {
App::uses('HtmlHelper', 'View/Helper');
$Html = new HtmlHelper($view);
$Html->css('/lil_invoices/css/lil_invoices.css', null, array('inline' => false));
}
return true;
}
示例3: _addScripts
/**
* _addScripts method
*
* Adds properties
*
* @param mixed $view
* @return boolean
*/
public function _addScripts($view)
{
if ($this->request->params['plugin'] == 'lil_tasks' || $this->request->params['plugin'] == 'lil' && $this->request->params['action'] == 'admin_dashboard') {
App::uses('HtmlHelper', 'View/Helper');
$Html = new HtmlHelper($view);
$Html->css('/lil_tasks/css/lil_tasks.css', null, array('inline' => false));
$Html->script('/lil_tasks/js/lil_tasks.js');
}
return true;
}
示例4: HtmlHelper
function __toString()
{
$help = new HtmlHelper();
$html = $help->css('/admin/custom/formtabs.css') . $help->javascript('/admin/custom/formtabs.js');
$html .= '<div id="tabs">';
foreach ($this->tabs as $tab) {
$html .= $help->absoluteLink($tab[0], '#' . $tab[1]);
}
$html .= '<div class="clear"></div></div>';
$html .= $this->getClientValidationHtml();
return $html;
}
示例5: css
public function css($path, $rel = null, $options = array())
{
$options += array('assetFilter' => true);
if (!$options['assetFilter']) {
$__backup = Configure::read('Asset.filter.css');
Configure::write('Asset.filter.css', null);
}
unset($options['assetFilter']);
$result = parent::css($path, $rel, $options);
if (isset($__backup)) {
Configure::write('Asset.filter.css', $__backup);
}
return $result;
}
示例6: HtmlHelper
function __toString()
{
if ($this->countElements() < $this->min_inputs) {
for ($i = 0; $i < $this->min_inputs - $this->countElements(); $i++) {
$this->add();
}
}
$html = new HtmlHelper();
$output = $html->javascript('/widgets/custom/textlist.js');
$output .= $html->css('/widgets/custom/textlist.css');
$output .= '<div class="phaxsi-textlist" data-max="' . $this->max_inputs . '" data-callback="' . $this->on_insert . '" data-name="' . $this->_name . '">';
$output .= '<div>' . $this->toString() . '</div>';
$output .= $this->max_inputs == 0 || count($this->_elements) < $this->max_inputs ? $html->absoluteLink($this->link_text, 'javascript:void(0)', '') : '';
$output .= '</div>';
return $output;
}
示例7: css
/**
* Include Zuluru-specific CSS files from the configured location.
* This replicates a bare minimum of the main HtmlHelper's css function,
* to avoid prefixing absolute paths. Everything else is passed to the
* parent for processing.
*/
function css($path, $rel = null, $options = array())
{
$base = Configure::read('urls.zuluru_css');
if (is_array($path)) {
$paths = array();
foreach ($path as $i) {
$paths[] = $this->css($i, $rel, $options);
}
return implode("\n", $paths);
}
if (strpos($path, '://') !== false) {
$url = $path;
} else {
if ($path[0] !== '/') {
$url = $base . $path;
}
}
return parent::css($url, $rel, $options);
}
示例8: scriptsForLayout
public function scriptsForLayout($type = null)
{
$scripts = '';
$files = $this->Baklava->getCombined();
foreach ($files as $t => $file) {
if ($type && $type != $t) {
continue;
}
switch ($t) {
case 'css':
$scripts .= parent::css($file, null, array('inline' => true));
break;
case 'js':
$scripts .= parent::script($file, array('inline' => true, 'defer' => true));
break;
case 'style':
$scripts .= parent::tag('style', $file, array('type' => 'text/css'));
break;
}
}
return $scripts;
}
示例9: twitter_login_button
/**
* Template code for including the twitter login button into the theme
*
* @param boolean $display_if_logged_in
* @return html|string
*/
function twitter_login_button($display_if_logged_in = true)
{
//initializing variables
App::import('Helper', 'Session');
$Session = new SessionComponent();
$auth = $Session->read('Auth');
//reasons to fail
if (twitter('profile.id', null, false)) {
return false;
}
if (!$display_if_logged_in && isset($auth['User']['id'])) {
return false;
}
// The same as require('controllers/users_controller.php');
App::import('Helper', 'Html');
$html = new HtmlHelper();
$html->css('/twitterlogin/css/style.css', 'stylesheet', array('inline' => false));
echo "<a href='" . Router::url(array('admin' => false, 'plugin' => null, 'controller' => 'twitterlogin', 'action' => 'authorize'), true) . "'><div class='twitter-login-lighter'></div></a>";
}
示例10: css
/**
* Concrete5's default behavior expects $file to be a string; so we can send it an array to override the default
* behavior and use our own solution; all the while remaining backwards-compatible with other Concrete5 functionality.
*
* $file as an array can contain any of the following optional items:
* $url // STRING (relative or absolute link to the file)
* $script // STRING (the actual js code)
* $css // STRING (the actual css code)
* $media // STRING (media attribute value for <style> tag)
* $inline // BOOL
* $minify // BOOL (minify the code first?)
* $IE // BOOL (surround in IE conditional comments?)
* $IEversion // STRING (IE's condition to check i.e. 'lte IE 6')
* $fullTag // STRING (if tag has already been assembled, but needs to be added to document)
* $fixRelativeLinks // BOOL (should we fix relative links inside the CSS? Only works for $inline=true. Defaults to true.
*
* Example Usage:
* $this->addHeaderItems($html->css(array(
* 'url' => 'styles/page_IE.css',
* 'inline' => true,
* 'minify' => true,
* 'IE' => true,
* 'IEversion' => 'lte IE 6'
* )));
*/
public function css($file, $pkgHandle = null)
{
if (!is_array($file)) {
// Use default behavior
return parent::css($file, $pkgHandle);
} else {
// Override the default behavior
$css = new V2CSSOutputObject();
// create a new variable name so it's not so confusing...
$args = $file;
// apply any submitted arguments to the CSSOutputObject
if (isset($args['url'])) {
$css->url = $args['url'];
}
if (isset($args['css'])) {
$css->css = $args['css'];
}
if (isset($args['media'])) {
$css->media = $args['media'];
}
if (isset($args['inline'])) {
$css->inline = $args['inline'];
}
if (isset($args['minify'])) {
$css->minify = $args['minify'];
}
if (isset($args['IE'])) {
$css->IE = $args['IE'];
}
if (isset($args['IEversion'])) {
$css->IEversion = $args['IEversion'];
}
if (isset($args['fullTag'])) {
$css->fullTag = $args['fullTag'];
}
if (isset($args['fixRelativeLinks'])) {
$css->fixRelativeLinks = $args['fixRelativeLinks'];
}
// Validate URLs to see if they match a local file
if ($css->url && !preg_match('/^http:/', $css->url) && !strstr($css->url, '../')) {
// for relative links only... and for security reasons, don't allow ../ in the url
// The following code blocks are mostly copied straight from the CORE HtmlHelper
$v = View::getInstance();
if ($v->getThemeDirectory() != '' && file_exists($v->getThemeDirectory() . '/' . $css->url)) {
// checking the theme directory for it. It's just in the root.
$css->file = $v->getThemePath() . '/' . $css->url;
$css->rel = $v->getThemePath() . '/';
$css->abs = $v->getThemeDirectory() . '/' . $css->url;
} else {
if ($pkgHandle != null) {
if (file_exists(DIR_BASE . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CSS . '/' . $css->url)) {
$css->file = DIR_REL . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CSS . '/' . $css->url;
$css->rel = DIR_REL . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CSS . '/';
$css->abs = DIR_BASE . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CSS . '/' . $css->url;
} else {
if (file_exists(DIR_BASE_CORE . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CSS . '/' . $css->url)) {
$css->file = ASSETS_URL . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CSS . '/' . $css->url;
$css->rel = ASSETS_URL . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CSS . '/';
$css->abs = DIR_BASE_CORE . '/' . DIRNAME_PACKAGES . '/' . $pkgHandle . '/' . DIRNAME_CSS . '/' . $css->url;
}
}
}
}
if ($css->file == '') {
if (file_exists(DIR_BASE . '/' . DIRNAME_CSS . '/' . $css->url)) {
$css->file = DIR_REL . '/' . DIRNAME_CSS . '/' . $css->url;
$css->rel = DIR_REL . '/' . DIRNAME_CSS . '/';
$css->abs = DIR_BASE . '/' . DIRNAME_CSS . '/' . $css->url;
} elseif (file_exists(DIR_BASE . '/' . DIRNAME_APP . '/' . DIRNAME_CSS . '/' . $css->url)) {
// this works but it's not good to hard-code it in.
$css->file = ASSETS_URL_CSS . '/' . $css->url;
$css->rel = ASSETS_URL_CSS . '/';
$css->abs = DIR_BASE . '/' . DIRNAME_APP . '/' . DIRNAME_CSS . '/' . $css->url;
} elseif (file_exists(DIR_BASE . '/' . $css->url)) {
$css->file = DIR_REL . '/' . $css->url;
//.........这里部分代码省略.........
示例11: getHeadHtml
protected function getHeadHtml()
{
$html = new HtmlHelper($this->context);
$output = '';
foreach ($this->metas as $meta) {
if ($meta['name']) {
$output .= "<meta name=\"{$meta['name']}\" content=\"" . HtmlHelper::escape($meta['content']) . "\" />\r\n";
} elseif ($meta['http-equiv']) {
$output .= "<meta http-equiv=\"{$meta['http-equiv']}\" content=\"" . HtmlHelper::escape($meta['content']) . "\" />\r\n";
}
}
$output .= "<title>" . HtmlHelper::escape($this->title) . "</title>\r\n";
$output .= '<base href="' . UrlHelper::get('/') . '"/>' . "\r\n";
if ($this->favico) {
$output .= '<link rel="icon" type="' . $this->favico[1] . "\" href=\"" . UrlHelper::resource($this->favico[0]) . "\">\r\n";
}
if ($this->description) {
$output .= '<meta name="description" content="' . HtmlHelper::escape($this->description) . "\" />\r\n";
}
if ($this->keywords) {
$output .= '<meta name="keywords" content="' . HtmlHelper::escape($this->keywords) . "\" />\r\n";
}
foreach ($this->feeds as $feed) {
$output .= '<link rel="alternate" type="application/rss+xml" title="RSS" href="' . UrlHelper::get($feed) . "\" />\r\n";
}
foreach ($this->styles as $style) {
$output .= $html->css($style[0], $style[1]) . "\r\n";
}
if ($this->js_library) {
$output .= "<script type=\"text/javascript\" src=\"{$this->js_library}\"></script>\r\n";
$output .= $html->javascript('/' . APPU_PHAXSI . '/' . 'phaxsi-' . PhaxsiConfig::FRAMEWORK_VERSION . (AppConfig::DEBUG_MODE ? '' : '.min') . '.js') . "\r\n";
$output .= HtmlHelper::inlineJavascript("Phaxsi.path = {" . "base: '" . UrlHelper::get('') . "'," . "local: '" . UrlHelper::localized('/') . "'," . "'public': '" . APPU_PUBLIC . "'," . "lang: '" . Lang::getCurrent() . "'}");
}
foreach ($this->scripts as $script) {
$output .= $html->javascript($script) . "\r\n";
}
$this->styles = $this->scripts = array();
return $output;
}
示例12: css
/**
* Load CSS for the current page
*
* @param array $path Names of CSS for the current page
* @param array $options Options for the css element
* @return string A link tag for the head element
*/
public function css($path = array(), $options = array())
{
$out = parent::css($this->pathCSS);
if ($this->faLoad) {
$out .= parent::css($this->faPath);
}
if ($this->bsAddonLoad) {
$out .= parent::css($this->bsAddonPath);
}
// Others CSS
foreach ($path as $css) {
$out .= parent::css($css, $options);
}
return $out;
}