Я использую шаблон на моем сайте. Шаблон использует jquery v1.7.1 и bootstrap v3.0.0 на странице индекса и, например, домашнюю страницу выпускника (localhost: 8080 / sie / web / index.php? R = site / alumno).
Проблема заключается в том, когда я вхожу в систему и пытаюсь перемещаться по сайту. На сайте много модалов, и каждый раз, когда я перемещаюсь по странице с модалом, меню не отображается или исчезает. И после входа в систему меню исчезает в индексе.
Вот некоторые изображения:
Индекс не авторизован OK
Вход не зарегистрированв порядке
Alumno Home не показывает меню
Возврат к индексу, вход в систему, не показ меню
Я использую ресурсы для регистрации файлов начальной загрузки и jquery в индексном и основном макетах, как показано ниже:
IndexAsset.php
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace app\assets;
use yii\web\AssetBundle;
/**
* Main application asset bundle.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class IndexAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/index/bootstrap-theme.css',
'css/index/camera.css',
'css/index/font-awesome.min.css',
'css/index/isotope.css',
'css/index/style.css',
'css/index/site.css',
];
public $js = [
'js/index/slider.js',
'js/index/bootstrap.min.js',
'js/index/google-map.js',
'js/index/html5shiv.js',
'js/index/jquery.cslider.js',
'js/index/jquery.isotope.min.js',
'js/index/respond.min.js',
'js/index/modernizr-latest.js',
'js/index/jquery.min.js',
'js/index/fancybox/jquery.fancybox.pack.js',
'js/index/jquery.mobile.customized.min.js',
'js/index/jquery.easing.1.3.js',
'js/index/camera.min.js',
'js/index/custom.js',
];
public $depends = [
'yii\web\YiiAsset',
'yii\web\JqueryAsset',
'yii\bootstrap\BootstrapAsset',
];
}
AppAsset.php
<?php
namespace app\assets;
use yii\web\AssetBundle;
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/main/bootstrap-theme.css',
'css/main/site.css',
'css/main/style.css',
];
public $js = [
'js/main/bootstrap.min.js',
'js/main/jquery.min.js'
];
public $depends = [
'yii\web\YiiAsset',
'yii\web\JqueryAsset',
'yii\bootstrap\BootstrapAsset',
];
}
layout.php layout
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use app\widgets\Alert;
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
use app\assets\IndexAsset;
use app\models\User;
IndexAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title)?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<!-- Button for smallest screens -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
<a class="navbar-brand" href="index.php">
<img src="images/logo.png" alt="Techro HTML5 template"></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav pull-right mainNav">
<?php if (Yii::$app->user->isGuest) { ?>
<li class="active"><?=Html::a('Inicio', ['index'])?></li>
<li><?=Html::a('Acerca', ['about'])?></li>
<li><?=Html::a('Contacto', ['contact'])?></li>
<li><?=Html::a('Login', ['login'])?></li>
<?php } else if (User::isUserDirector (Yii::$app->user->identity->id))
{ ?>
<li class="active"><?=Html::a('Calendario', ['calendario/index'])?></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Área Docente <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><?=Html::a('Profesores', ['profesor/index'])?></li>
<li><?=Html::a('Asignatura', ['asignatura/index'])?></li>
<li><?=Html::a('Cursos', ['curso/index'])?></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Libro de Clases <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><?=Html::a('Alumnos', ['alumno/index'])?></li>
<li><?=Html::a('Notas', ['nota/index'])?></li>
<li><?=Html::a('Apoderados', ['apoderado/index'])?></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Cuenta <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><?=Html::a('Perfil('.Yii::$app->user->identity->username.')', ['site/director'])?></li>
<li><?=Html::a('Cerrar Sesión', ['site/logout'], ['data-method' => 'post'])?></li>
</ul>
</li>
<?php } ?>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<div class="wrap">
<div class="container">
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
<?= Alert::widget() ?>
<?= $content ?>
</div>
</div>
<footer id="footer">
<div class="container">
<div class="row">
<div class="footerbottom">
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Course Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li><a href="#">
List of Technology
</a>
</li>
<li><a href="#">
List of Business
</a>
</li>
<li><a href="#">
List of Photography
</a>
</li>
<li><a href="#">
List of Language
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Products Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li> <a href="#">
Individual Plans </a>
</li>
<li><a href="#">
Business Plans
</a>
</li>
<li><a href="#">
Free Trial
</a>
</li>
<li><a href="#">
Academic
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Browse by Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li><a href="#">
All Courses
</a>
</li>
<li> <a href="#">
All Instructors
</a>
</li>
<li><a href="#">
All Members
</a>
</li>
<li>
<a href="#">
All Groups
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>Contact</h4>
<p>Lorem reksi this dummy text unde omnis iste natus error sit volupum</p>
<div class="contact-info">
<i class="fa fa-map-marker"></i> Kerniles 416 - United Kingdom<br>
<i class="fa fa-phone"></i>+00 123 156 711 <br>
<i class="fa fa-envelope-o"></i> youremail@email.com
</div>
</div><!-- end widget -->
</div>
</div>
</div>
<div class="social text-center">
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-dribbble"></i></a>
<a href="#"><i class="fa fa-flickr"></i></a>
<a href="#"><i class="fa fa-github"></i></a>
</div>
<div class="clear"></div>
<!--CLEAR FLOATS-->
</div>
<div class="footer2">
<div class="container">
<div class="row">
<div class="col-md-6 panel">
<div class="panel-body">
<p class="simplenav">
<a href="index.html">Home</a> |
<a href="about.html">About</a> |
<a href="courses.html">Courses</a> |
<a href="price.html">Price</a> |
<a href="videos.html">Videos</a> |
<a href="contact.html">Contact</a>
</p>
</div>
</div>
<div class="col-md-6 panel">
<div class="panel-body">
<p class="text-right">
Copyright © 2014. Template by <a href="http://webthemez.com/" rel="develop">WebThemez.com</a>
</p>
</div>
</div>
</div>
<!-- /row of panels -->
</div>
</div>
</footer>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
main.php layout
<?php
/* @var $this \yii\web\View */
/* @var $content string */
use app\widgets\Alert;
use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;
use app\models\User;
AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
<meta charset="<?= Yii::$app->charset ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title)?></title>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<!-- Button for smallest screens -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
<a class="navbar-brand" href="index.php">
<img src="images/logo.png" alt="Techro HTML5 template"></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav pull-right mainNav">
<?php if (Yii::$app->user->isGuest) { ?>
<li class="active"><?=Html::a('Inicio', ['index'])?></li>
<li><?=Html::a('Acerca', ['about'])?></li>
<li><?=Html::a('Contacto', ['contact'])?></li>
<li><?=Html::a('Login', ['login'])?></li>
<?php } else if (User::isUserDirector (Yii::$app->user->identity->id))
{ ?>
<li class="active"><?=Html::a('Calendario', ['calendario/index'])?></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Área Docente <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><?=Html::a('Profesores', ['profesor/index'])?></li>
<li><?=Html::a('Asignatura', ['asignatura/index'])?></li>
<li><?=Html::a('Cursos', ['curso/index'])?></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Libro de Clases <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><?=Html::a('Alumnos', ['alumno/index'])?></li>
<li><?=Html::a('Notas', ['nota/index'])?></li>
<li><?=Html::a('Apoderados', ['apoderado/index'])?></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Cuenta <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><?=Html::a('Perfil('.Yii::$app->user->identity->username.')', ['site/director'])?></li>
<li><?=Html::a('Cerrar Sesión', ['site/logout'], ['data-method' => 'post'])?></li>
</ul>
</li>
<?php } ?>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
<header id="head" class="secondary">
<div class="container">
<h1><?= Html::encode($this->title) ?></h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing eliras scele!</p>
</div>
</header>
<div class="wrap">
<div class="container">
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
<?= Alert::widget() ?>
<?= $content ?>
</div>
</div>
<footer id="footer">
<div class="container">
<div class="row">
<div class="footerbottom">
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Course Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li><a href="#">
List of Technology
</a>
</li>
<li><a href="#">
List of Business
</a>
</li>
<li><a href="#">
List of Photography
</a>
</li>
<li><a href="#">
List of Language
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Products Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li> <a href="#">
Individual Plans </a>
</li>
<li><a href="#">
Business Plans
</a>
</li>
<li><a href="#">
Free Trial
</a>
</li>
<li><a href="#">
Academic
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>
Browse by Categories
</h4>
<div class="menu-course">
<ul class="menu">
<li><a href="#">
All Courses
</a>
</li>
<li> <a href="#">
All Instructors
</a>
</li>
<li><a href="#">
All Members
</a>
</li>
<li>
<a href="#">
All Groups
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-3 col-sm-6">
<div class="footerwidget">
<h4>Contact</h4>
<p>Lorem reksi this dummy text unde omnis iste natus error sit volupum</p>
<div class="contact-info">
<i class="fa fa-map-marker"></i> Kerniles 416 - United Kingdom<br>
<i class="fa fa-phone"></i>+00 123 156 711 <br>
<i class="fa fa-envelope-o"></i> youremail@email.com
</div>
</div><!-- end widget -->
</div>
</div>
</div>
<div class="social text-center">
<a href="#"><i class="fa fa-twitter"></i></a>
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-dribbble"></i></a>
<a href="#"><i class="fa fa-flickr"></i></a>
<a href="#"><i class="fa fa-github"></i></a>
</div>
<div class="clear"></div>
<!--CLEAR FLOATS-->
</div>
<div class="footer2">
<div class="container">
<div class="row">
<div class="col-md-6 panel">
<div class="panel-body">
<p class="simplenav">
<a href="index.html">Home</a> |
<a href="about.html">About</a> |
<a href="courses.html">Courses</a> |
<a href="price.html">Price</a> |
<a href="videos.html">Videos</a> |
<a href="contact.html">Contact</a>
</p>
</div>
</div>
<div class="col-md-6 panel">
<div class="panel-body">
<p class="text-right">
Copyright © 2014. Template by <a href="http://webthemez.com/" rel="develop">WebThemez.com</a>
</p>
</div>
</div>
</div>
<!-- /row of panels -->
</div>
</div>
</footer>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
Я обнаружил эту ошибку в index.php, связанном с jiiery Bootstrap vii.4.1 yii
Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4
at bootstrap.js:15
at bootstrap.js:17
, а этот относится к модальной функции и шаблону jquery v1.7.1 в alumno home
Uncaught TypeError: jQuery(...).modal is not a function
at HTMLDocument.<anonymous> (index.php?r=site%2Falumno:217)
at n (jquery.min.js:2)
at Object.fireWith (jquery.min.js:2)
at Function.ready (jquery.min.js:2)
at HTMLDocument.B (jquery.min.js:2)
Есть какие-нибудь мысли о том, как я могу использовать обе версии, мою и yii в jquery? Любая помощь будет оценена, я очень смущен