Reputation:
The question is simple, but maybe the answer not.
I am wondering how can copy and paste my <footer>CONTENT HERE</footer>
created by Bootstrap in all my pages automatically.
Is there some easy way to do that? Because on the Internet I only can read very complex ways.
Thanks
Upvotes: 0
Views: 370
Reputation: 4210
Here is a sample structure of how to include the layout structure in HTML page.
<!DOCTYPE html>
<html>
<head>
<?php include('includes/meta.php'); ?> <!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<![endif]-->
<?php include('includes/page_title.php') ?>
<!-- BOOTSTRAP CORE STYLE -->
<?php include('includes/header_scripts.php'); ?>
</head>
<body>
<?php include('includes/header.php'); ?>
<!-- LOGO HEADER END-->
<?php include('includes/header_menu.php'); ?>
<!-- MENU SECTION END-->
<div class="content-wrapper">
<div class="container">
<div class="row pad-botm">
<div class="col-md-12">
<h4 class="header-line">Blank Page</h4>
</div>
</div>
</div>
</div>
<!-- CONTENT-WRAPPER SECTION END-->
<?php include('includes/footer.php'); ?>
<!-- FOOTER SECTION END-->
<!-- JAVASCRIPT FILES PLACED AT THE BOTTOM TO REDUCE THE LOADING TIME -->
<!-- CORE JQUERY -->
<?php include('includes/footer_scripts.php'); ?>
</body>
</html>
footer.php
<footer>CONTENT HERE</footer>
Like this if you put a separate file and call it in all the other pages and it will be created dynamically in all the pages if you edit or change in this file alone.
Like the above way you need to create all the pages and include it into your project file.
Folder Structure
Project Folder
Upvotes: 1
Reputation: 4423
You can accomplish this with jquery.
Place this code in index.html
<html>
<head>
<title></title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(function(){
$("#footer").load("footer.html");
});
</script>
</head>
<body>
<div id="footer"></div>
</body>
</html
Here is a stack overflow page that can help you with this
Also if you are using php this will be more simple
<html>
<body>
<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<?php include 'footer.php';?>
</body>
</html>
Just create your footer in footer.php
Here is w3schools post if you want to know more about php and how to include this.
Upvotes: 0
Reputation: 19764
You seem to be confusing how the page gets rendered. CSS is used for styling content which is already there provided by the HTML, so Bootstrap cannot help you here. Bootstarp did not "create" the content of the footer, it jsut gives it some styling.
Depending on the back-end technology you use for generating pages (maybe Jade, EJS, PHP?), you need to do some sort of inclusion of the footer template.
Upvotes: 1