0
Good morning.
I have a system to open the pages (linked in the menu) within a site DIV, is working properly.
But I’m not getting one thing, set an initial page already inside this DIV.
In this case it would be my page/home.php, but I don’t know how to leave it inside the DIV when I enter localhost/index.php.
Follow the code of the index.php page
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Moraes Automóveis</title>
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/css.css">
<link rel="stylesheet" type="text/css" href="css/footer.css">
</head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!---------------------------------------------------------------------------------------------------------------------------------
Exclusivamente esses estilos só funcionam colocando aqui na index.php, quando ponho dentro do css/css.css não dá retorno algum
----------------------------------------------------------------------------------------------------------------------------------->
<style type="text/css">
#footer-copyright {
color: white;
}
.section1 {
padding-top: 55px;
}
</style>
<!--------------------------------------------------------
Esse script é pro ícone flutuante do WhatsApp no site
---------------------------------------------------------->
<script type="text/javascript">
(function () {
var options = {
whatsapp: "+554733453668", // Número do WhatsApp
greeting_message: "Olá! Precisa de alguma ajuda?", // Texto principal
call_to_action: "Entre em contato conosco..", // Chamada para ação
position: "right", // Posição do widget na página 'right' ou 'left'
};
var proto = document.location.protocol, host = "whatshelp.io", url = proto + "//static." + host;
var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = url + '/widget-send-button/js/init.js';
s.onload = function () { WhWidgetSendButton.init(host, proto, options); };
var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
})();
</script>
</head>
<body>
<!-----------------------------------------
Navbar do site - Utilizando Bootstrap3
------------------------------------------->
<center><nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-head">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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">
<img src="img/logo.png" width="150px">
</a>
</div>
<!---------------------------------------------
Início de links para carregar dentro da div
----------------------------------------------->
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav" id="menu">
<li>
<a href="./index.php?pg=home">Inicio</a>
</li>
<li>
<a href="./index.php?pg=empresa">Empresa</a>
</li>
<li>
<a href="./index.php?pg=estoque">Estoque</a>
</li>
<li>
<a href="./index.php?pg=financiamento">Financiamento</a>
</li>
<li>
<a href="./index.php?pg=vendaseuveiculo">Venda seu veículo</a>
</li>
<li>
<a href="./index.php?pg=contato">Contato</a>
</li>
</div>
</div>
</nav></center>
<!---------------
Logo do site
----------------->
<div class="section1 row" id="logo">
<div class="col-sm-12 hidden-xs">
<img src="img/logomaior2.png">
</div>
</div>
<!-----------------------------
Div que receberá as páginas
------------------------------->
<div class="container" id="conteudo">
<div class="col-sm-12 w-auto p-3">
<?php
// -----------------------
//Código em php funcionando
// -----------------------
if (isset($_GET['pg'])) {
$Pagina = $_GET['pg'];
if ($Pagina == "home") {
include('pages/home.php');
} else if ($Pagina == "empresa") {
include('pages/empresa.php');
} else if ($Pagina == "estoque") {
include('pages/estoque.php');
} else if ($Pagina == "") {
include('pages/home.php');
} else {
include("pages/error.php");
}
}
?>
</div>
</div>
<!--------------------
Rodapé do site
--------------------->
<footer id="myFooter">
<div id="footer-copyright" class="container">
© 2020 Copyright - Moraes Automóveis
</div>
<div class="footer-social">
<a href="https://fb.com/moraesautomoveis" class="social-icons"><i class="fa fa-facebook"></i></a>
<a href="https://instagram.com/moraesautomoveis" class="social-icons"><i class="fa fa-instagram"></i></a>
</div>
</footer>
</body>
</html>
Thank you very much, Diogo. It worked.
– Guga