PHP script feedback in webpage - php

I am trying a build a web portal which runs a php script script that calls a batch file in windows, which in turn executes a powershell script that run powercli to fetch required info from vmware vcenter. All the result is sent to a file named f1.txt and f1.html sources this file and displays the output.All my codes are below.
The below solution works but, I have a requirement to display some output instead of a blank page when f1.php script is running and waiting for output from the underlying powershell script f1.bat -> f1.ps1.
Some progress report or direct feedback from the php script would do while the webpage is waiting the php script to finish.
For eg: Loading... with blinking dots or output from the script itself.
I have tried the flush() method and ob_flush() method in f1.php but it just gives me a blank screen with the output and once the php script completes running the nav bar gets loaded below that output.The page is all mangled.
How can I get the desired result with minimal code manipulation. If ajax or javascript is required for the task, then I'm open to that as well.
I have the below in index.php
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.dropdown-submenu {
position: relative;
}
.dropdown-submenu .dropdown-menu {
top: 0;
left: 100%;
margin-top: -1px;
}
#media (min-width: 979px) {
ul.nav li.dropdown:hover > ul.dropdown-menu {
display: block;
}
}
ul.nav li.dropdown-submenu:hover > ul.dropdown-menu {
display: block;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse ">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">VMware VC Reports</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="dropdown"><a class="dropdown" data-toggle="dropdown" href="#">Vcenters<span class=caret></span></a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a class="test" tabindex="-1" href="#">San Jose Vcenter<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a tabindex="-1" href="http://mickey.example.com/view/f1.php">ESX Info</a></li>
<li><a tabindex="-1" href="http://mickey.example.com/view/f2.php">Firmware Info</a></li>
</li>
</ul>
</li>
</ul>
</ul>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$('.dropdown-submenu a.test').on("click", function(e){
$(this).next('ul').toggle();
e.stopPropagation();
e.preventDefault();
});
});
</script>
</body>
</html>
I have the below in f1.php file.
<?php
system("f1.bat");
header("Location:http://mickey.example.com/view/f1.html");
exit;
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.dropdown-submenu {
position: relative;
}
.dropdown-submenu .dropdown-menu {
top: 0;
left: 100%;
margin-top: -1px;
}
#media (min-width: 979px) {
ul.nav li.dropdown:hover > ul.dropdown-menu {
display: block;
}
}
ul.nav li.dropdown-submenu:hover > ul.dropdown-menu {
display: block;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse ">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">VMware VC Reports</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="dropdown"><a class="dropdown" data-toggle="dropdown" href="#">Vcenters<span class=caret></span></a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a class="test" tabindex="-1" href="#">San Jose Vcenter<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a tabindex="-1" href="http://mickey.example.com/view/f1.php">ESX Info</a></li>
<li><a tabindex="-1" href="http://mickey.example.com/view/f2.php">Firmware Info</a></li>
</li>
</ul>
</li>
</ul>
</ul>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$('.dropdown-submenu a.test').on("click", function(e){
$(this).next('ul').toggle();
e.stopPropagation();
e.preventDefault();
});
});
</script>
</body>
</html>
I have the below in f1.html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.dropdown-submenu {
position: relative;
}
.dropdown-submenu .dropdown-menu {
top: 0;
left: 100%;
margin-top: -1px;
}
#media (min-width: 979px) {
ul.nav li.dropdown:hover > ul.dropdown-menu {
display: block;
}
}
ul.nav li.dropdown-submenu:hover > ul.dropdown-menu {
display: block;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse ">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">VMware VC Reports</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="dropdown"><a class="dropdown" data-toggle="dropdown" href="#">Vcenters<span class=caret></span></a>
<ul class="dropdown-menu">
<li class="dropdown-submenu">
<a class="test" tabindex="-1" href="#">San Jose Vcenter<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a tabindex="-1" href="http://mickey.example.com/view/f1.php">ESX Info</a></li>
<li><a tabindex="-1" href="http://mickey.example.com/view/f2.php">Firmware Info</a></li>
</li>
</ul>
</li>
</ul>
</ul>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$('.dropdown-submenu a.test').on("click", function(e){
$(this).next('ul').toggle();
e.stopPropagation();
e.preventDefault();
});
});
</script>
<script type="text/javascript">
<!--
var iframe = document.createElement("iframe");
iframe.src = "f1.txt";
iframe.width = "20000";
iframe.height = "20000";
iframe.frameBorder = "0";
iframe.scrolling = "no";
document.body.appendChild(iframe);
//-->
</script>
</body>
</html>

Related

Bootstrap modal will not show up

I am trying to implement the login and signup forms of my site as a bootstrap modal, but the modal is not showing up at all after clicking the link inside the navbar. I have encountered on couple of similar questions on this topic before, but none of the solutions seem to be working for me. JQuery is included so I have no clue what could be causing modal to be shy to show up. Can anyone help, please? Code is as follows:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="Mc8MyxbLVQ93MY1dMlbE6y9NXzlTiVrVB80P0lYl">
<link rel="stylesheet" href="http://mypage.me/css/app.css">
<title>MyPage</title>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-
q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<style>
body, html {
height: 100%;
margin: 0;
}
.bg {
/* The image used */
background-image: url("/images/ukay3.jpg");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.navbar { margin-bottom: 0 !important; }
</style>
</head>
<body>
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal">Logi</a>
<!-- Old Navbar -->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<!-- Section: Logo and collapse button -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a style="display:block; margin:7px; margin-right:20px" href="/ " class="pull-left"><img
src="/images/logosmall.png" alt="Not found!"></a>
</div><!-- End Section: Logo and collapse button -->
<!-- Section: Collapsible part of Navbar -->
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Market</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="/about">About<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li>Page1</li>
<li>Page2</li>
<li>Page3</li>
</ul>
</li>
<!--<li>About</li>-->
<li>Services</li>
<li>Contact</li>
</ul>
<!-- Section: Right side of Navbar -->
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
<li class="nav-item">
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal"><span
class="glyphicon glyphicon-log-in"></span> Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://mypage.me/register"><span class="glyphicon
glyphicon-user"></span> Sign Up</a>
</li>
</ul><!-- Right Side of Navbar --><!-- End Section: Right side of Navbar -->
</div><!-- End Section: Collapsible part of Navbar -->
</div>
</nav>
<!-- Login Modal -->
<div class="modal fade" id="loginModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal End --> <div class="bg"></div>
<div class="container">
<div class="jumbotron text-center">
<h1>Welcome to MyPage.com</h1>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="Mc8MyxbLVQ93MY1dMlbE6y9NXzlTiVrVB80P0lYl">
<link rel="stylesheet" href="http://mypage.me/css/app.css">
<title>MyPage</title>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-
q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<style>
body, html {
height: 100%;
margin: 0;
}
.bg {
/* The image used */
background-image: url("/images/ukay3.jpg");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.navbar { margin-bottom: 0 !important; }
</style>
</head>
<body>
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal">Logi</a>
<!-- Old Navbar -->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<!-- Section: Logo and collapse button -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a style="display:block; margin:7px; margin-right:20px" href="/ " class="pull-left"><img
src="/images/logosmall.png" alt="Not found!"></a>
</div><!-- End Section: Logo and collapse button -->
<!-- Section: Collapsible part of Navbar -->
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Market</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="/about">About<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li>Page1</li>
<li>Page2</li>
<li>Page3</li>
</ul>
</li>
<!--<li>About</li>-->
<li>Services</li>
<li>Contact</li>
</ul>
<!-- Section: Right side of Navbar -->
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
<li class="nav-item">
<a class="nav-link" href="#loginModal" data-toggle="modal" data-target="#loginModal"><span
class="glyphicon glyphicon-log-in"></span> Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://mypage.me/register"><span class="glyphicon
glyphicon-user"></span> Sign Up</a>
</li>
</ul><!-- Right Side of Navbar --><!-- End Section: Right side of Navbar -->
</div><!-- End Section: Collapsible part of Navbar -->
</div>
</nav>
<!-- Login Modal -->
<div class="modal fade" id="loginModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal End --> <div class="bg"></div>
<div class="container">
<div class="jumbotron text-center">
<h1>Welcome to MyPage.com</h1>
</div>
</div>
</body>
</html>
Seems like your cdn is not supporting your code i have added cdn of bootstrap4 below
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="Mc8MyxbLVQ93MY1dMlbE6y9NXzlTiVrVB80P0lYl">
<link rel="stylesheet" href="http://mypage.me/css/app.css">
<title>MyPage</title>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<style>
body, html {
height: 100%;
margin: 0;
}
.bg {
/* The image used */
background-image: url("/images/ukay3.jpg");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.navbar { margin-bottom: 0 !important; }
</style>
</head>
<body>
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal">Logi</a>
<!-- Old Navbar -->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<!-- Section: Logo and collapse button -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a style="display:block; margin:7px; margin-right:20px" href="/ " class="pull-left"><img
src="/images/logosmall.png" alt="Not found!"></a>
</div><!-- End Section: Logo and collapse button -->
<!-- Section: Collapsible part of Navbar -->
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Market</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="/about">About<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li>Page1</li>
<li>Page2</li>
<li>Page3</li>
</ul>
</li>
<!--<li>About</li>-->
<li>Services</li>
<li>Contact</li>
</ul>
<!-- Section: Right side of Navbar -->
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
<li class="nav-item">
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal"><span
class="glyphicon glyphicon-log-in"></span> Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://mypage.me/register"><span class="glyphicon
glyphicon-user"></span> Sign Up</a>
</li>
</ul><!-- Right Side of Navbar --><!-- End Section: Right side of Navbar -->
</div><!-- End Section: Collapsible part of Navbar -->
</div>
</nav>
<!-- Login Modal -->
<div class="modal fade" id="loginModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal End --> <div class="bg"></div>
<div class="container">
<div class="jumbotron text-center">
<h1>Welcome to MyPage.com</h1>
</div>
</div>
</body>
</html>
Add the bootstrap css into the head of your html: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>MyPage</title>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-
q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
</head>
<body>
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal">Login</a>
<!-- Login Modal -->
<div class="modal fade" id="loginModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal End --> <div class="bg"></div>
<div class="container">
<div class="jumbotron text-center">
<h1>Welcome to MyPage.com</h1>
</div>
</div>
</body>
</html>
Just add this in your header.
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
try to import bootstarp css files to the head before the app.css.
something like this
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="Mc8MyxbLVQ93MY1dMlbE6y9NXzlTiVrVB80P0lYl">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="http://mypage.me/css/app.css">
<title>MyPage</title>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<style>
body,
html {
height: 100%;
margin: 0;
}
.bg {
/* The image used */
background-image: url("/images/ukay3.jpg");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.navbar {
margin-bottom: 0 !important;
}
</style>
</head>
<body>
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal">Logi</a>
<!-- Old Navbar -->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<!-- Section: Logo and collapse button -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a style="display:block; margin:7px; margin-right:20px" href="/ " class="pull-left"><img
src="/images/logosmall.png" alt="Not found!"></a>
</div><!-- End Section: Logo and collapse button -->
<!-- Section: Collapsible part of Navbar -->
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Market</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="/about">About<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li>Page1</li>
<li>Page2</li>
<li>Page3</li>
</ul>
</li>
<!--<li>About</li>-->
<li>Services</li>
<li>Contact</li>
</ul>
<!-- Section: Right side of Navbar -->
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
<li class="nav-item">
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal"><span
class="glyphicon glyphicon-log-in"></span> Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://mypage.me/register"><span class="glyphicon
glyphicon-user"></span> Sign Up</a>
</li>
</ul><!-- Right Side of Navbar -->
<!-- End Section: Right side of Navbar -->
</div><!-- End Section: Collapsible part of Navbar -->
</div>
</nav>
<!-- Login Modal -->
<div class="modal fade" id="loginModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal End -->
<div class="bg"></div>
<div class="container">
<div class="jumbotron text-center">
<h1>Welcome to MyPage.com</h1>
</div>
</div>
</body>
</html>
Link bootstrap.min.css file in you current code and define proper classes on modal html section. Check below code it is working fine...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- CSRF Token -->
<meta name="csrf-token" content="Mc8MyxbLVQ93MY1dMlbE6y9NXzlTiVrVB80P0lYl" />
<link rel="stylesheet" href="http://mypage.me/css/app.css">
<title>MyPage</title>
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-
q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<style>
body, html {
height: 100%;
margin: 0;
}
.bg {
/* The image used */
background-image: url("/images/ukay3.jpg");
/* Full height */
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.navbar { margin-bottom: 0 !important; }
</style>
</head>
<body>
<!-- Old Navbar -->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<!-- Section: Logo and collapse button -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a style="display:block; margin:7px; margin-right:20px" href="/ " class="pull-left"><img
src="/images/logosmall.png" alt="Not found!"></a>
</div><!-- End Section: Logo and collapse button -->
<!-- Section: Collapsible part of Navbar -->
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li>Home</li>
<li>Market</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="/about">About<span class="caret">
</span></a>
<ul class="dropdown-menu">
<li>Page1</li>
<li>Page2</li>
<li>Page3</li>
</ul>
</li>
<!--<li>About</li>-->
<li>Services</li>
<li>Contact</li>
</ul>
<!-- Section: Right side of Navbar -->
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
<li class="nav-item">
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal"><span
class="glyphicon glyphicon-log-in"></span> Login</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://mypage.me/register"><span class="glyphicon
glyphicon-user"></span> Sign Up</a>
</li>
</ul><!-- Right Side of Navbar --><!-- End Section: Right side of Navbar -->
</div><!-- End Section: Collapsible part of Navbar -->
</div>
</nav>
<!-- Login Modal -->
<div class="modal" id="loginModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Modal End --> <div class="bg"></div>
<div class="container">
<div class="jumbotron text-center">
<h1>Welcome to Mohd. Aslam</h1>
</div>
</div>
</body>
</html>

dropdown bootstrap not working in mobile

I'm having an issue where a dropdown menu in my website works on a desktop, but failed in mobile view.
The following is an example of a website I created: http://www.pakarraya.com/dropdown/
according to some examples of bootstrap dropdown menus in various references, here's the script I wrote:
<div class="navigation collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="current">Home</li>
<li>About</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Menu Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Dropdown 1</li>
<li>Dropdown 2</li>
<li>Dropdown 3</li>
</ul>
</li>
<li>Contact</li>
</ul>
</div>
I beg for solutions from advanced colleagues, thank you very much
This will perfectly solves your problem please check i have uploaded screen shot also
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.topnav {
overflow: hidden;
background-color: #333;
}
.topnav a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.active {
background-color: #4CAF50;
color: white;
}
.topnav .icon {
display: none;
}
#media screen and (max-width: 600px) {
.topnav a:not(:first-child) {display: none;}
.topnav a.icon {
float: right;
display: block;
}
}
#media screen and (max-width: 600px) {
.topnav.responsive {position: relative;}
.topnav.responsive .icon {
position: absolute;
right: 0;
top: 0;
}
.topnav.responsive a {
float: none;
display: block;
text-align: left;
}
}
</style>
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Brand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>Link</li>
<li class="dropdown">
Dropdown <span class="caret"></span>
<ul class="dropdown-menu">
<li class="current">Home</li>
<li>About</li>
<li class="dropdown-menu">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Menu Dropdown<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>Dropdown 1</li>
<li>Dropdown 2</li>
<li>Dropdown 3</li>
</ul>
</li>
<li>Contact</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</body>
</html>
Output
[![screenshot][1]][1]

Bootstrap - Why is my navbar background color being overwritten even when I specify it?

Why does my navbar both side have a white background color?
I used the developer tool to try and help me and the part that change it white was the navbar default. I try to change the css inside the developer tool using this and it work.
This is the part that I changed inside the developer tool:
.navbar-default {
background-color: blue;
}
I also tried to change in the app.css and change the navbar-default to blue but the problem is still occurring, and when I check inside the developer tool, the color code is white instead of the blue that I had just changed. But it works if I change it inside the developer tool.
I tried following this question, but it doesn't work as well:
Background color in navbar laravel.
My page consists of an HTML table, and I have used #extends to put the navbar inside this page. When I try doing it for other pages, the navbar works.
htmlTable.blade.php:
#extends('layouts.app')
#section('title', 'Summary')
#section('content')
<div class="container" style="background-color:#ADD8E8">
//content of my html table
</div>
#endsection
app.blade.php (navbar):
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>#yield('title')</title>
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="{{ asset('css/title.css') }}" rel="stylesheet">
</head>
<body>
<div id="app">
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<!-- Collapsed Hamburger -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse" aria-expanded="false">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
#include('layouts.testSidebar')
<!-- Branding Image -->
<a class="navbar-brand" href="{{ url('/') }}" style="color: white">
#yield('title')
</a>
</div>
<div class="collapse navbar-collapse" id="app-navbar-collapse">
<!-- Left Side Of Navbar -->
<ul class="nav navbar-nav">
</ul>
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
#guest
<li>Login</li>
<li>Register</li>
#else
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" style="background-color:blue">
<b style="color: white">{{ Auth::user()->name }}</b> <span class="caret"></span>
</a>
<ul class="dropdown-menu" style="background-color: blue">
<li>
<a href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();" style="background-color: blue">
<b style="color: white">Logout</b>
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
{{ csrf_field() }}
</form>
</li>
</ul>
</li>
#endguest
</ul>
</div>
</div>
</nav>
#yield('content')
</div>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
test.css (this is the CSS that I used):
body{
margin:0px;
padding:0px;
font-family:"Helvetica Neue", Helvetica, Arial;
}
#sidebar{
background:blue;
width:200px;
height:100%;
display:block;
position:fixed;
left:-200px;
top:0px;
transition:left 0.3s linear;
}
#sidebar.visible{
left:0px;
transition:left 0.3s linear;
}
ul{
margin:0px;
padding:0px;
}
ul li{
list-style:none;
}
ul li a{
background:#0000FF ;
color:white;
border-bottom:1px solid #111;
display:block;
width:180px;
padding:10px;
text-decoration: none;
}
#sidebar-btn{
display:inline-block;
vertical-align: middle;
width:20px;
height:15px;
cursor:pointer;
margin:20px;
position:absolute;
top:0px;
right:-60px;
}
#sidebar-btn span{
height:1px;
background:white;
margin-bottom:5px;
display:block;
}
#sidebar-btn span:nth-child(2){
width:75%;
}
#sidebar-btn span:nth-child(3){
width:50%;
}
#navbar-toggle collapsed{
background:#0000FF ;
}
.navbar {background:#0000FF ;}
nav.sidebar .navbar-nav .open .dropdown-menu>li>a:hover, nav.sidebar .navbar-nav .open .dropdown-menu>li>a:focus {
color: white;
background-color: transparent;
}
.dropdown-menu {
position: absolute;
top: 0;
left: 180px;
min-width: 180px;
}
This is what happens:
change this:
<div id="app">
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
to:
<div id="app">
<nav class="navbar navbar-default navbar-static-top">
<div class="container-fluid">
<div class="navbar-header">
The container-fluid class is the one you want

Sidebar color not changing laravel

for some reason my sidebar color isn't changing, I have no idea why, it also even affect until my logout button which turn it into black in color. When I try to remove the code for the sidebar, the logout button color return back to normal. But I had already changed the color inside the css file already to another color but still doesn't work. Can anyone help me? Thanks in advance
When I used the chrome developer tool to try change the color at there it work but when I refresh it, the color black remains there again, but when I try to change it inside the code the color black still remains there also:
ul li a{
background:#ADD8E6;
Here is a screenshot: (all the way to the right is the logout button)
app.blade.php
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
</head>
<body>
<div id="app">
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<!-- Collapsed Hamburger -->
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse" aria-expanded="false">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<title>SideBar Menu</title>
<link href="{{ asset('css/style.css') }}" rel="stylesheet">
</head>
<body>
<div id="sidebar">
<ul>
<li>Home</li>
<li>Waiting List</li>
</ul>
<div id="sidebar-btn">
<span></span>
<span></span>
<span></span>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#sidebar-btn').click(function(){
$('#sidebar').toggleClass('visible');
});
});
</script>
<!-- Branding Image -->
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
</div>
<div class="collapse navbar-collapse" id="app-navbar-collapse">
<!-- Left Side Of Navbar -->
<ul class="nav navbar-nav">
</ul>
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
#guest
<li>Login</li>
<li>Register</li>
#else
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true">
{{ Auth::user()->name }} <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
Logout
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
{{ csrf_field() }}
</form>
</li>
</ul>
</li>
#endguest
</ul>
</div>
</div>
</nav>
#yield('content')
</div>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
style.css
body{
margin:0px;
padding:0px;
font-family:"Helvetica Neue", Helvetica, Arial;
background-color: blue;
}
#sidebar{
background:#ADD8E6;
width:200px;
height:100%;
display:block;
position:absolute;
left:-200px;
top:0px;
transition:left 0.3s linear;
}
#sidebar.visible{
left:0px;
transition:left 0.3s linear;
}
ul{
margin:0px;
padding:0px;
}
ul li{
list-style:none;
}
ul li a{
background:#ADD8E6;
color:#ccc;
border-bottom:1px solid #111;
display:block;
width:180px;
padding:10px;
text-decoration: none;
}
#sidebar-btn{
display:inline-block;
vertical-align: middle;
width:20px;
height:15px;
cursor:pointer;
margin:20px;
position:absolute;
top:0px;
right:-60px;
}
#sidebar-btn span{
height:1px;
background:#111;
margin-bottom:5px;
display:block;
}
#sidebar-btn span:nth-child(2){
width:75%;
}
#sidebar-btn span:nth-child(3){
width:50%;
}
I Think Your CSS Has been Con fit , check That In enter image description here

CSS styles are not being applied in header

I have a header.php file that I want to include in a CodeIgniter view. The header is shown but the problem is that the CSS styles that I have written inside the header.php file are not applied and I don't understand why.
This is my header:
<html>
<head>
<title><?php echo $title;?></title>
<link rel="stylesheet"
href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body >
<style>
.nav.navbar-nav li a{
color: #3232ff;
}
</style>
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
<li> <span class="glyphicon glyphicon-home"></span> Home
</li>
<li> <span class="glyphicon glyphicon-off"></span> Log out
</li>
</ul>
</div>
</nav>
</body>
</html>
P.S The weird thing is, if I include the css as inline styling , it works
The specificity of the bootstrap style forces you to use important:
<!doctype html>
<html>
<head>
<title>TITLE</title>
<link rel="stylesheet"
href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
ul.navbar-nav li a {
color: red !important;
}
</style>
</head>
<body >
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
<li> <span class="glyphicon glyphicon-home"></span> Home </li>
<li> <span class="glyphicon glyphicon-off"></span> Log out</li>
</ul>
</div>
</nav>
</body>
</html>
You're calling it wrong, You should remove the dot before the nav, that way you select the element.
This is working and I've tested:
nav .navbar-nav li a{
color: #3232ff !importan;
}
This way you are referring to a .nav-bar class in a nav element.
See result here:
<html>
<head>
<title><?php echo $title;?></title>
<link rel="stylesheet"
href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body >
<style>
nav .navbar-nav li a{
color: #000000 !important;
}
</style>
<nav class="navbar navbar-default">
<div class="container-fluid">
<ul class="nav navbar-nav">
<li> <span class="glyphicon glyphicon-home"></span> Home
</li>
<li> <span class="glyphicon glyphicon-off"></span> Log out
</li>
</ul>
</div>
</nav>
</body>
</html>

Categories