Дело в том что мне нужен индикатор загрузки на сайте. Я нашел несколько неплохих работающих на jquery. Вот они:
1й
После тега <body> вставляем код:
<div style="position:relative" id="zv-load">
<div class="zv-load-css">
<img src="{THEME}/images/zvlad-loading.gif" alt="Загружаем страницу..." style="vertical-align: middle;" > Загружаем страницу...</div>
</div>
А это перед тегом </body> (конечный тег)
<script language="javascript" type="text/javascript">
$(window).load(function () {
$("#zv-load").fadeOut("slow");
});
</script>
в CSS:
.zv-load-css {
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
position:fixed;
top:5px;
left:5px;
background:rgba(0,0,0,0.7);
color:#fff;
padding:6px 10px;
z-index:999;
font-size:11px;
font-family:Tahoma;
}
2й
<head>
<script type="text/javascript" src="/sys/jquery.blockUI.js?v2.31"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
$.blockUI({message:'Немного подождите,идет построение страницы...<br><img src="/sys/wait.gif" border="0" width="48" height="48" alt=""><br><a href="javascript://" onclick="$.unblockUI();return false;" style="font-size:7pt;">Разблокировать<\/a>',css:{background:'#fff',border:'5px solid #e0e0e0',padding:'3px'},overlayCSS:{background:'#000',opacity:.9}});
$(window).load(function(){
_uWnd.close('codeAlert');
$.unblockUI();
});
});
</script>
</body>
Дело в том что в шаблоне который я использую (yoo explorer) уже встроен jquery1.4.4
При использовании индикатора загрузчика в 1м случае, он после загрузки страницы не перестает работать, работает безконечно, как будто не подключен jquery. Но если подключить тот же jquery(установленый в шаблон) вручную в файле template.config.php
здесь
$this->warp->javascripts->add('js:jquery.js');
в файле template.config.php
<?php
/**
* @package yoo_explorer Template
* @file template.config.php
* @version 5.5.9 January 2011
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) 2007 - 2011 YOOtheme GmbH
* @license YOOtheme Proprietary Use License (http://www.yootheme.com/license)
*/
// init vars
$config =& $this->warp->getHelper('config');
// set template css
$color = $config->get('color');
$css = '.wrapper { width: '.intval($config->get('template_width')).$config->get('template_width_unit')."; }\n";
/* 3-column-layout */
if ($this->warp->modules->count('left')) {
$css .= '#main-shift { margin-left: '.(intval($config->get('left_width')) + intval($config->get('left_space')))."px; }\n";
$css .= '#left { width: '.intval($config->get('left_width'))."px; }\n";
}
if ($this->warp->modules->count('right')) {
if (!$this->warp->modules->count('left')) { $config->set('left_width', '0'); }
$css .= '#main-shift { margin-right: '.(intval($config->get('right_width')) + intval($config->get('right_space')))."px; }\n";
$css .= '#right { width: '.intval($config->get('right_width')).'px; margin-left: -'.(intval($config->get('left_width')) + intval($config->get('right_width')))."px; }\n";
}
/* inner 3-column-layout */
if ($this->warp->modules->count('contentleft')) {
$css .= '#content-shift { margin-left: '.(intval($config->get('contentleft_width')) + intval($config->get('contentleft_space')))."px; }\n";
$css .= '#contentleft { width: '.intval($config->get('contentleft_width'))."px; }\n";
}
if ($this->warp->modules->count('contentright')) {
if (!$this->warp->modules->count('contentleft')) { $config->set('contentleft_width', '0'); }
$css .= '#content-shift { margin-right: '.(intval($config->get('contentright_width')) + intval($config->get('contentright_space')))."px; }\n";
$css .= '#contentright { width: '.intval($config->get('contentright_width')).'px; margin-left: -'.(intval($config->get('contentleft_width')) + intval($config->get('contentright_width')))."px; }\n";
}
/* drop down menu */
$css .= '#menu .dropdown { width: '.intval($config->get('menu_width'))."px; }\n";
$css .= '#menu .columns2 { width: '.(2*intval($config->get('menu_width')))."px; }\n";
$css .= '#menu .columns3 { width: '.(3*intval($config->get('menu_width')))."px; }\n";
$css .= '#menu .columns4 { width: '.(4*intval($config->get('menu_width')))."px; }\n";
$this->warp->stylesheets->addDeclaration($css);
$this->warp->stylesheets->add('css:reset.css');
$this->warp->stylesheets->add('css:layout.css');
$this->warp->stylesheets->add('css:typography.css');
$this->warp->stylesheets->add('css:menus.css');
$this->warp->stylesheets->add('css:modules.css');
$this->warp->stylesheets->add('css:system.css');
$this->warp->stylesheets->add('css:extensions.css');
if ($config->get('direction') == 'rtl') { $this->warp->stylesheets->add('template:css/rtl.css'); }
if ($color != '' && $color != 'default') {
$color_url = 'template:css/variations/';
$this->warp->stylesheets->add($color_url.$color.'.css');
}
$this->warp->stylesheets->add('template:css/custom.css');
$script = '';
$separator = false;
$params = array('tplurl' => "'".$this->warp->path->url('template:')."'");
if ($color = $config->get('color')) {
$params['color'] = "'$color'";
}
if ($itemcolor = $config->get('itemcolor')) {
$params['itemColor'] = "'$itemcolor'";
}
foreach ($params as $name => $value) {
$separator ? $script .= ', ' : $separator = true;
$script .= $name.': '.$value;
}
$script = 'var Warp = Warp || {}; Warp.Settings = { '.$script.' };';
$this->warp->javascripts->addDeclaration($script);
$this->warp->javascripts->add('js:jquery.js');
$this->warp->javascripts->add('js:warp.js');
$this->warp->javascripts->add('js:accordionmenu.js');
$this->warp->javascripts->add('js:dropdownmenu.js');
$this->warp->javascripts->add('js:template.js');
// ie7 hacks
if ($this->warp->useragent->browser() == 'msie' && $this->warp->useragent->version() == '7.0') {
$css = '<link rel="stylesheet" href="%s" type="text/css" />';
$ie7[] = sprintf($css, $this->warp->path->url('css:ie7hacks.css'));
$head[] = '<!--[if IE 7]>'.implode("\n", $ie7).'<![endif]-->';
}
// ie6 hacks
if ($this->warp->useragent->browser() == 'msie' && $this->warp->useragent->version() == '6.0') {
$css = '<link rel="stylesheet" href="%s" type="text/css" />';
$js = '<script type="text/javascript" src="%s"></script>';
$ie6[] = sprintf($css, $this->warp->path->url('css:ie6hacks.css'));
$ie6[] = sprintf($js, $this->warp->path->url('js:ie6fix.js'));
$ie6[] = sprintf($js, $this->warp->path->url('js:ie6png.js'));
$ie6[] = sprintf($js, $this->warp->path->url('js:ie6.js'));
$head[] = '<!--[if IE 6]>'.implode("\n", $ie6).'<![endif]-->';
}
// add $head
if (isset($head)) {
$this->warp->template->set('head', implode("\n", $head));
}
// set CSS class for specific columns
$columns = null;
if ($this->warp->modules->count('left')) $columns .= 'column-left';
if ($this->warp->modules->count('right')) $columns .= ' column-right';
if ($this->warp->modules->count('contentleft')) $columns .= ' column-contentleft';
if ($this->warp->modules->count('contentright')) $columns .= ' column-contentright';
$config->set('columns', $columns);
то он работает без проблем,но перестают работать важнейшие компоненты шаблона. и наоборот
во 2м случае индикатор вообще не работает пока не подключишь jquery вручную. Но опять же перестают работать важные компоненты шаблона.
template.php
<?php
/**
* @package yoo_explorer Template
* @file template.php
* @version 5.5.9 January 2011
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) 2007 - 2011 YOOtheme GmbH
* @license YOOtheme Proprietary Use License (http://www.yootheme.com/license)
*/
// get template configuration
include(dirname(__FILE__).'/template.config.php');
?>
<!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="<?php echo $this->warp->config->get('language'); ?>" lang="<?php echo $this->warp->config->get('language'); ?>" dir="<?php echo $this->warp->config->get('direction'); ?>" >
<head>
<?php echo $this->warp->template->render('head'); ?>
<script type="text/javascript" src="/sys/jquery.blockUI.js?v2.31"></script>
<link rel="apple-touch-icon" href="<?php echo $this->warp->path->url('template:apple_touch_icon.png'); ?>" />
</head>
<body id="page" class="yoopage <?php echo $this->warp->config->get('columns'); ?> <?php echo $this->warp->config->get('itemcolor'); ?>">
<script type="text/javascript">
$(document).ready(function(){
$.blockUI({message:'Немного подождите,идет построение страницы...<br><img src="/sys/wait.gif" border="0" width="48" height="48" alt=""><br><a href="javascript://" onclick="$.unblockUI();return false;" style="font-size:7pt;">Разблокировать<\/a>',css:{background:'#fff',border:'5px solid #e0e0e0',padding:'3px'},overlayCSS:{background:'#000',opacity:.9}});
$(window).load(function(){
_uWnd.close('codeAlert');
$.unblockUI();
});
});
</script>
<?php if($this->warp->modules->count('absolute')) : ?>
<div id="absolute">
<?php echo $this->warp->modules->render('absolute'); ?>
</div>
<div style="position:relative" id="zv-load">
<div class="zv-load-css">
<img src="/js/loading.gif" alt="Загружаем страницу..." style="vertical-align: middle;" > Please Wait...Loading...</div>
</div>
<?php endif; ?>
<div id="page-body">
<div class="wrapper">
<div id="header">
<div id="toolbar">
<?php if($this->warp->config->get('date')) : ?>
<div id="date">
<?php echo $this->warp->config->get('actual_date'); ?>
</div>
<?php endif; ?>
<?php if($this->warp->modules->count('toolbarleft')) : ?>
<div class="left">
<?php echo $this->warp->modules->render('toolbarleft'); ?>
</div>
<?php endif; ?>
<?php if($this->warp->modules->count('toolbarright')) : ?>
<div class="right">
<?php echo $this->warp->modules->render('toolbarright'); ?>
</div>
<?php endif; ?>
</div>
<div id="headerbar">
<?php if($this->warp->modules->count('headerleft')) : ?>
<div class="left">
<?php echo $this->warp->modules->render('headerleft'); ?>
</div>
<?php endif; ?>
<?php if($this->warp->modules->count('headerright')) : ?>
<div class="right">
<?php echo $this->warp->modules->render('headerright'); ?>
</div>
<?php endif; ?>
</div>
<div id="menubar">
<div class="menubar-2">
<div class="menubar-3"></div>
</div>
</div>
<?php if($this->warp->modules->count('logo')) : ?>
<div id="logo">
<?php echo $this->warp->modules->render('logo'); ?>
</div>
<?php endif; ?>
<?php if($this->warp->modules->count('menu')) : ?>
<div id="menu">
<?php echo $this->warp->modules->render('menu'); ?>
</div>
<?php endif; ?>
<?php if($this->warp->modules->count('search')) : ?>
<div id="search">
<?php echo $this->warp->modules->render('search'); ?>
</div>
<?php endif; ?>
<?php if ($this->warp->modules->count('banner')) : ?>
<div id="banner">
<?php echo $this->warp->modules->render('banner'); ?>
</div>
<?php endif; ?>
</div>
<!-- header end -->
<div class="wrapper-body">
<div class="wrapper-t1">
<div class="wrapper-t2">
<div class="wrapper-t3"></div>
</div>
</div>
<div class="wrapper-1">
<div class="wrapper-2">
<div class="wrapper-3">
<?php if ($this->warp->modules->count('top + topblock')) : ?>
<div class="wrapper-inner-1">
<div class="wrapper-inner-2">
<div id="top">
<?php if($this->warp->modules->count('topblock')) : ?>
<div class="topblock width100 float-left">
<?php echo $this->warp->modules->render('topblock'); ?>
</div>
<?php endif; ?>
<?php if ($this->warp->modules->count('top')) : ?>
<?php echo $this->warp->modules->render('top', array('wrapper'=>"topbox float-left", 'layout'=>$this->warp->config->get('top'))); ?>
<?php endif; ?>
</div>
</div>
</div>
<div class="wrapper-inner-b1"><div class="wrapper-inner-b2"><div class="wrapper-inner-b3"></div></div></div>
<!-- top end -->
<?php endif; ?>
<div class="wrapper-inner-1">
<div class="wrapper-inner-2">
<div id="middle">
<div id="middle-expand">
<div id="main">
<div id="main-shift">
<?php if ($this->warp->modules->count('maintop')) : ?>
<div id="maintop">
<?php echo $this->warp->modules->render('maintop', array('wrapper'=>"maintopbox float-left", 'layout'=>$this->warp->config->get('maintop'))); ?>
</div>
<!-- maintop end -->
<?php endif; ?>
<div id="mainmiddle">
<div id="mainmiddle-expand">
<div id="content">
<div id="content-shift">
<?php if ($this->warp->modules->count('breadcrumbs')) : ?>
<div id="breadcrumbs">
<div class="breadcrumbs-1">
<div class="breadcrumbs-2">
<div class="breadcrumbs-3">
<?php echo $this->warp->modules->render('breadcrumbs'); ?>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php if ($this->warp->modules->count('contenttop')) : ?>
<div id="contenttop">
<?php echo $this->warp->modules->render('contenttop', array('wrapper'=>"contenttopbox float-left", 'layout'=>$this->warp->config->get('contenttop'))); ?>
</div>
<!-- contenttop end -->
<?php endif; ?>
<div class="floatbox">
<?php echo $this->warp->template->render('content'); ?>
</div>
<?php if ($this->warp->modules->count('contentbottom')) : ?>
<div id="contentbottom">
<?php echo $this->warp->modules->render('contentbottom', array('wrapper'=>"contentbottombox float-left", 'layout'=>$this->warp->config->get('contentbottom'))); ?>
</div>
<!-- mainbottom end -->
<?php endif; ?>
</div>
</div>
<!-- content end -->
<?php if($this->warp->modules->count('contentleft')) : ?>
<div id="contentleft">
<?php echo $this->warp->modules->render('contentleft'); ?>
</div>
<?php endif; ?>
<?php if($this->warp->modules->count('contentright')) : ?>
<div id="contentright">
<?php echo $this->warp->modules->render('contentright'); ?>
</div>
<?php endif; ?>
</div>
</div>
<!-- mainmiddle end -->
<?php if ($this->warp->modules->count('mainbottom')) : ?>
<div id="mainbottom">
<?php echo $this->warp->modules->render('mainbottom', array('wrapper'=>"mainbottombox float-left", 'layout'=>$this->warp->config->get('mainbottom'))); ?>
</div>
<!-- mainbottom end -->
<?php endif; ?>
</div>
</div>
<?php if($this->warp->modules->count('left')) : ?>
<div id="left">
<?php echo $this->warp->modules->render('left'); ?>
</div>
<?php endif; ?>
<?php if($this->warp->modules->count('right')) : ?>
<div id="right">
<?php echo $this->warp->modules->render('right'); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<div class="wrapper-inner-b1<?php if (!$this->warp->modules->count('bottom')) echo "-last"; ?>"><div class="wrapper-inner-b2"><div class="wrapper-inner-b3"></div></div></div>
<?php if ($this->warp->modules->count('bottom + bottomblock')) : ?>
<div class="wrapper-inner-1">
<div class="wrapper-inner-2">
<div id="bottom">
<?php if ($this->warp->modules->count('bottom')) : ?>
<?php echo $this->warp->modules->render('bottom', array('wrapper'=>"bottombox float-left", 'layout'=>$this->warp->config->get('bottom'))); ?>
<?php endif; ?>
<?php if($this->warp->modules->count('bottomblock')) : ?>
<div class="bottomblock width100 float-left">
<?php echo $this->warp->modules->render('bottomblock'); ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="wrapper-inner-b1-last"><div class="wrapper-inner-b2"><div class="wrapper-inner-b3"></div></div></div>
<!-- bottom end -->
<?php endif; ?> <div style="display:none;"><a href="http://www.taoyog.ru/">Yoga and massage</a></div>
<div id="footer">
<a class="anchor" href="#page"></a>
<?php echo $this->warp->modules->render('footer'); ?>
</div>
<!-- footer end -->
</div>
</div>
</div>
<div class="wrapper-b1">
<div class="wrapper-b2">
<div class="wrapper-b3"></div>
</div>
</div>
</div>
</div>
</div>
<div class="wrapper">
<?php echo $this->warp->modules->render('debug'); ?>
</div>
<script language="javascript" type="text/javascript">
$(window).load(function () {
$("#zv-load").fadeOut("slow");
});
</script>
</body>
</html>
На стандартном шаблоне Joomla все работает т.к. там все подключается в index.php i jquery не встрен сразу
Помогите нубу
я уже неделю пытаюсь чтото придумать.
А моем шаблоне jquery (по умолчанию) подключается в head.php
<?php
/**
* @package Warp Theme Framework
* @file head.php
* @version 5.5.11
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright 2007 - 2011 YOOtheme GmbH
* @license YOOtheme Proprietary Use License (http://www.yootheme.com/license)
*/
// load mootools
JHTML::_('behavior.mootools');
// get HTML head data
$head = $this->warp->system->document->getHeadData();
// jQuery loaded by FLEXIcontent ?
if (isset($head['scripts']['administrator/components/com_flexicontent/assets/js/jquery-1.4.min.js'])) {
$this->warp->system->application->set('jquery', true);
}
// load jQuery first, if not loaded before
//if (!$this->warp->system->application->get('jquery')) {
// $this->warp->system->application->set('jquery', true);
// $head['scripts'] = array_merge(array($this->warp->path->url('lib:jquery/jquery.js') => 'text/javascript'), $head['scripts']);
// $this->warp->system->document->setHeadData($head);
//}
$style_urls = array_keys($this->warp->stylesheets->get());
$script_urls = array_keys($this->warp->javascripts->get());
// get compressed styles and scripts
if ($compression = $this->warp->config->get('compression')) {
$options = array();
if ($compression >= 2) {
$options['gzip'] = true;
}
if ($compression == 3) {
$options['data_uri'] = true;
}
if ($urls = $this->warp->cache->processStylesheets($style_urls, $options)) {
$style_urls = $urls;
}
if ($urls = $this->warp->cache->processJavascripts($script_urls, $options)) {
$script_urls = $urls;
}
$head = $this->warp->system->document->getHeadData();
if (count($head['styleSheets'])) {
foreach ($head['styleSheets'] as $style => $meta) {
if (preg_match('/\.css$/i', $style) && ($url = $this->warp->cache->processStylesheets(array($style), array_merge($options, array('data_uri' => false))))) {
$style = array_shift($url);
}
$styles[$style] = $meta;
}
$head['styleSheets'] = $styles;
}
if (count($head['scripts'])) {
foreach ($head['scripts'] as $script => $meta) {
if (preg_match('/\.js$/i', $script) && ($url = $this->warp->cache->processJavascripts(array($script), $options))) {
$script = array_shift($url);
}
$scripts[$script] = $meta;
}
$head['scripts'] = $scripts;
}
$this->warp->system->document->setHeadData($head);
}
// add styles
foreach ($style_urls as $style) {
$this->warp->system->document->addStyleSheet($style);
}
// add scripts
foreach ($script_urls as $script) {
$this->warp->system->document->addScript($script);
}
// add style declarations
foreach ($this->warp->stylesheets->getDeclarations() as $type => $style) {
$this->warp->system->document->addStyleDeclaration($style, $type);
}
// add script declarations
foreach ($this->warp->javascripts->getDeclarations() as $type => $script) {
$this->warp->system->document->addScriptDeclaration($script, $type);
}
?>
<jdoc:include type="head" />
<?php $this->output('head'); ?>