0
ステージングサーバーのモーダルウィンドウの読み込みに問題があります。私のモーダルウィンドウがローカルホスト(Apache)にロードされる場合、ステージングでコンテンツをロードできません(LiteSpeed)。奇妙なのは、モーダルが開いてヘッダーが表示されますが、内容は表示されないということです。私は要素を調べるときに503エラーが発生します。Yii2 - モーダルの読み込み中コンテンツがありません
ステージングでもfaviconはロードされません。私はこの問題がどこかにあると考えていますが、Yii2で始まったばかりなので、もうどこを見てもわかりません。次のように私はモーダル機能を作成している
:ウェブ/ JS/modal.jsで
modal.js
$(function(){
$(document).on('click', '.showModalButton', function(){
if ($('#modal').data('bs.modal').isShown) {
$('#modal').find('#modalContent')
.load($(this).attr('value'));
//dynamically set the header for the modal
document.getElementById('modalHeader').innerHTML = '<button type="button" class="close" ' +
'data-dismiss="modal" aria-label="Close">' +
'<span aria-hidden="true">×</span>' +
'</button> ' +
'<h4>' + $(this).attr('title') + '</h4>';
} else {
$('#modal').modal('show')
.find('#modalContent')
.load($(this).attr('value'));
//dynamically set the header for the modal
document.getElementById('modalHeader').innerHTML = '<button type="button" class="close" ' +
'data-dismiss="modal" aria-label="Close">' +
'<span aria-hidden="true">×</span>' +
'</button> ' +
'<h4>' + $(this).attr('title') + '</h4>';
}
});
});
ビュー/レイアウト/ main.php(抜粋)に設定されたレイアウトを
</footer>
<?php
Modal::begin([
'headerOptions' => [
'id' => 'modalHeader',
],
//'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
'id' => 'modal',
'size' => 'modal-lg',
//keeps from closing modal with esc key or by clicking out of the modal.
// user must click cancel or X to close
'clientOptions' => [
'backdrop' => 'static',
'keyboard' => false
],
]);
echo "<div id='modalContent'></div>";
Modal::end();
?>
<?php $this->endBody() ?>
indexアクションのためのビュー(抜粋)
<p>
<?= Html::a('Create FAQ',
false,
[
'class' => 'showModalButton btn btn-success',
'value' => '/index.html?r=faq/create',
'title' => 'Create FAQ',
]) ?>
</p>
ボタンを押すとモーダルが開きますが、フォームはロードされません。
重要な情報が不足している場合は、この問題を解消できるかどうかを尋ねてください。
ページがすべてのアセットを読み込み、ステージングサーバー上でのみ503エラーが発生します。
それは動作しますが、それはモデルを保存しません。私はこれについてコントローラをチェックします。このソリューションでは、モーダルと呼ばれるすべてのビューを変更する必要があります。ありがとうございました** vijay!**今私は地獄の資産がロードされるのを見なければなりません、私はlocalhostでこの問題がないので。 – macmilan
このような問題を引き起こしている場合は、アセットを処理できます。 unset($ this-> assetBundles ['yii \ bootstrap \ BootstrapAsset']); unset($ this-> assetBundles ['yii \ web \ JqueryAsset']); unset($ this-> assetBundles ['yii \ web \ YiiAsset']); unset($ this-> assetBundles ['kartik \ widgets \ Select2Asset']); unset($ this-> assetBundles ['kartik \ widgets \ WidgetAsset']); –