I have some big problems including my header in subfolder. I have a folder structure like this:
[![Folder structure][1]][1]
I would like to include my header in the innovatian-project.php. As I see it, I have to go back three folders to get to the root:
AU -> Courses -> Document Root
I have tried with the following:
<?php include '../../../resources/includes/header.php'?>
<?php include(__DIR__.'/resources/includes/header.php'); ?>
<?php include($_SERVER['DOCUMENT_ROOT'].'/header.php'); ?>
<?php include($_SERVER['DOCUMENT_ROOT'].'/resources/includes/header.php'); ?>
<?php include('../../resources/includes/header.php'); ?>
But none of this is working. I have tried so many things, that I cannot even remember anymore. Does anybody have an idea on what I can do? The path to the innovation-project is here:
<?php include 'resources/includes/header.php' ?>
<body id="services">
<?php include 'resources/includes/navbar.php' ?>
<!-- start intro section -->
<section class="intro">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<div class="intro-content">
<h1>Mine kompetencer <strong>strongest </strong></h1>
<h2>areas, where I can add the most value to a company </h2>
Mine kompetencer er baseret på
</div>
</div>
</div>
</div>
</section>
<!-- end intro section -->
UPDATE
When I use the following code, the header, nav and footer is called. But the CSS is not called:
<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/header.php' ?>
<body id="services">
<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/navbar.php' ?>
<!-- start intro section -->
<section class="intro">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<div class="intro-content">
<h1>Mine kompetencer <strong>strongest </strong></h1>
<h2>areas, where I can add the most value to a company </h2>
Mine kompetencer er baseret på
</div>
</div>
</div>
</div>
</section>
<!-- end intro section -->
<?php include $_SERVER['DOCUMENT_ROOT'] . '/Portfolio_da/resources/includes/footer.php' ?>
UPDATE 2 WHERE I CALL THE CSS IN header.php
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Favicon -->
<link rel="shortcut icon" href="images/favicon.ico">
<!-- Stylesheets -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.css">
<link rel="stylesheet" href="css/owl.theme.css">
<link rel="stylesheet" href="css/owl.carousel.css">
<link rel="stylesheet" href="css/supersized.css">
<link rel="stylesheet" href="css/nivo-theme.css">
<link rel="stylesheet" href="css/nivo-lightbox.css">
<!-- Main Stylsheets -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/responsive.css">
<!-- Theme Color Stylesheet -->
<link rel="stylesheet" href="css/theme_color.css">
<!-- Google Font -->
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700' rel='stylesheet' type='text/css'>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<?php include_once("analyticstracking.php") ?>
</head>
<?php include($_SERVER['DOCUMENT_ROOT'].'/resources/includes/header.php'); ?>
See your php.ini about
allow_url_include
What is in your router file?
You have to go up 2 folders.
<?php include('../../resources/includes/header.php'); ?>
UPDATE
Change these lines in header.php: <link rel="stylesheet" href="css/bootstrap.min.css">
like <link rel="stylesheet" href="http://<?php echo $_SERVER['HTTP_HOST'] ?>/Portfolio_da/css/bootstrap.min.css">
Related
Hey i don't understand my website doesn't work i have don't do anything so i will explain
I got a 0 in top on my page now!
Google Chrome Explorator:Screenshot
https://validator.w3.org/nu/?doc=http%3A%2F%2Fwww.wisementrade.com%2F
View/header.php: https://pastebin.com/7GqFYR75
View/homepage.php: https://pastebin.com/3htmFSmw
View/footer.php: https://pastebin.com/b3X9KScg
Controller/View.php: https://pastebin.com/cxCdcdEQ
Chrome viewer code: https://pastebin.com/Q8VYja5u
I have check the encode UTF-8 and i have re encode UTF-8 with my sublime text but nothing change ... please need help
EDIT: FIXED
I guess unclosed HTML tag cause this problerm. I found a few unclosed HTML tag in your View/header.php. Close it. try this.
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!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"/>
<!--o-->
<?php
//Session
$customer_id = $this->session->userdata('customer_id');
$user_type = $this->session->userdata('user_type');
$statement = $this->session->userdata('timezone');
?>
<!--o-->
<link rel="icon" type="image/png" href="<?php echo base_url('images/favicon.png'); ?>" />
<meta name="author" content="Wise Men Trade" />
<meta name="copyright" content="Copyright Notice ©2015 WisemenTrade Limited and licensors. All rights reserved." />
<meta name="robots" content="all" />
<!--o-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script language="JavaScript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Bootstrap CSS -->
<link href="<?php echo base_url("css/bootstrap.min.css"); ?>" rel="stylesheet"/>
<!-- Basic CSS -->
<link href="<?php echo base_url("css/style.css"); ?>" rel="stylesheet"/>
<!-- Responsive CSS -->
<link href="<?php echo base_url("css/responsive.css"); ?>" rel="stylesheet"/>
<!-- Important Owl stylesheet -->
<link rel="stylesheet" href="<?php echo base_url("css/owl-carousel/owl.carousel.css"); ?>"/>
<!-- Default Theme -->
<link rel="stylesheet" href="<?php echo base_url("css/owl-carousel/owl.theme.css"); ?>"/>
<!-- MS DROP DOWN -->
<link rel="stylesheet" href="<?php echo base_url('css/msdropdown/flags.css'); ?>"/>
<link rel="stylesheet" href="<?php echo base_url('css/msdropdown/dd.css'); ?>"/>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-62333409-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
</head>
<body>
<!--top-header-->
<header>
<div class="header_block">
<!-- left -->
<div class="block_left">
<a href="<?php echo base_url(); ?>">
<img src="<?php echo base_url("images/log_wmt.png"); ?>" class="logo" width="130" height="130" alt="Logo Wise Men Trade" />
</a>
</div>
</div>
</header>
also in your Controller/View.php have a few unclosed div (<div id="container"> and <div class="block_content">). check it and close it.
the last, make sure at the end of your Controller/View.php have a :
</body> <!-- end of body -->
</html> <!-- end of html -->
According to the documentation (https://www.codeigniter.com/user_guide/general/views.html), you could load multiple views in your controller, I think it doesn't work if you load it in the view, so you should have something like this:
<?php
class Page extends CI_Controller {
public function index()
{
$data['page_title'] = 'Your title';
$this->load->view('header');
$this->load->view('menu');
$this->load->view('content', $data);
$this->load->view('footer');
}
}
I have a website with 50 pages. I have a header.html I include on every page. In the header I link to my external CSS, and the same counts for the footer, except the links here are to external JS.
But a few of my sites I need to use a specific CSS and JS, that I did not implement yet. If I include that in the header, it means that all my pages are loading an external CSS or JS file, which I dont think is so good?
Is there a way I can only call a script on a few pages, without setting it in my header.html or footer.html?
header.html
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Bootstrap core CSS -->
<link href="resources/library/bootstrap/bootstrap.min.css" rel="stylesheet"> <!-- ok -->
<link href="assets/css/core/theme.css" rel="stylesheet"> <!-- ok -->
<link href="resources/library/bootstrap/bootstrap-reset.css" rel="stylesheet"> <!-- ok -->
<!-- <link href="css/bootstrap.min.css" rel="stylesheet">-->
<!--external css-->
<link href="assets/fonts/font-awesome/css/font-awesome.css" rel="stylesheet" /> <!-- ok -->
<link rel="stylesheet" href="resources/library/flexslider/css/flexslider.css"/> <!-- ok -->
<link href="resources/library/bxslider/jquery.bxslider.css" rel="stylesheet" /> <!-- ok -->
<link rel="stylesheet" href="assets/css/core/animate.css"> <!-- ok -->
<link rel="stylesheet" href="resources/library/owlcarousel/css/owl.carousel.css"> <!-- ok -->
<link rel="stylesheet" href="resources/library/owlcarousel/css/owl.theme.css"> <!-- ok -->
<link href="resources/library/superfish/css/superfish.css" rel="stylesheet" media="screen"> <!-- ok -->
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
<!-- <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'> -->
<!-- Custom styles for this template -->
<link rel="stylesheet" type="text/css" href="assets/css/core/component.css"> <!-- ok -->
<link href="assets/css/core/style.css" rel="stylesheet"> <!-- ok -->
<link href="assets/css/core/style-responsive.css" rel="stylesheet" /> <!-- ok -->
<link rel="stylesheet" type="text/css" href="resources/library/parallax-slider/css/parallax-slider.css" /> <!-- ok -->
<script type="text/javascript" src="resources/library/parallax-slider/js/modernizr.custom.28468.js"></script> <!-- ok -->
</head>
index.php
<body>
<p> A lot of content</p>
<?php include 'resources/includes/footer.html';?>
footer.html
<div>
<div>
<p> A lot of content</p>
</div>
</div>
**<!-- ********* The Magnific popup script I only use on 2 sites: *********-->**
<script src="js/module/jquery.magnific-popup.js"></script>
<!-- Scripts for all sites -->
<script src="resources/library/bootstrap/jquery-1.8.3.min.js"></script> <!-- ok -->
<script src="resources/library/bootstrap/bootstrap.min.js"></script> <!-- ok -->
<script type="text/javascript" src="resources/library/superfish/js/hover-dropdown.js"></script> <!-- ok -->
<script defer src="resources/library/flexslider/js/jquery.flexslider.js"></script> <!-- ok -->
<script type="text/javascript" src="resources/library/bxslider/jquery.bxslider.js"></script> <!-- ok -->
<script type="text/javascript" src="resources/library/parallax-slider/js/jquery.parallax-1.1.3.js"></script> <!-- ok -->
<script type="text/javascript">
$('.image-caption a').tooltip();
$(function () {
var filterList = {
init: function () {
// MixItUp plugin
// http://mixitup.io
$('#portfoliolist-three').mixitup({
targetSelector: '.portfolio',
filterSelector: '.filter',
effects: ['fade'],
easing: 'snap',
// call the hover effect
onMixEnd: filterList.hoverEffect()
});
},
};
// Run the show!
filterList.init();
});
$( document ).ready(function() {
$('.magnefig').each(function(){
$(this).magnificPopup({
type:'image',
removalDelay: 300,
mainClass: 'mfp-fade'
})
});
});
</script>
</body>
</html>
Example:
These two links I need on 1 side. Where should those to links be placed?
<link rel="stylesheet" type="text/css" href="assets/css/module/mixitup.css"> <!-- ok -->
<link rel="stylesheet" href="assets/css/module/magnific-popup.css"> <!-- ok -->
There is a simple way in core php use include in your custom pages to add header and footer. To add extra css add in content pages
index.php without extra css
include('header.php');
<div>
content goes here
</div>
include('footer.php');
about.php with extra css
include('header.php');
<link rel="stylesheet" type="text/css" href="assets/css/module/mixitup.css"> <!-- ok -->
<link rel="stylesheet" href="assets/css/module/magnific-popup.css"> <!-- ok -->
<div>
content goes here
</div>
include('footer.php');
I have a basic webpage made up of a few PHP pages and a few CSS stylesheets. One of these stylesheets is style_common.css which is used by all pages on the website to provide a constant theme. I am having a bit of trouble with this file. I currently have only 2 PHP pages which reference this common CSS file.
The home page (index.php) references the CSS file fine, and the stylesheet styles it as you would expect. I copied the entire contents of index.php and pasted it into a second PHP file, then changed a few minor details such as the heading caption. This new page however, doesn't link to the CSS stylesheet.
My code is below:
style_common.css:
body {
background-color: #32BEED;
}
.header {
text-align: center;
padding: 0px;
}
index.php:
<!DOCTYPE HTML>
<html>
<head>
<title>324 SQN Canteen Manager</title>
<link type="text/css" rel="stylesheet" href="style_index.css"/>
<link type="text/css" rel="stylesheet" href="style_common.css"/>
</head>
<body>
<div class="header">
<img src="images/logo.png" class="aafclogo">
<h3> Canteen Manager</h3>
<h6>Designed by Me</h6>
</div>
<div class="buttonContainer">
<a href="addstock.php"><div class="button">
<p>Add Stock</p>
</div></a>
<a href="sellitems.php"><div class="button">
<p>Sell Items</p>
</div></a>
<a href="recordstocktake.php"><div class="button">
<p>Record Stocktake</p>
</div></a>
</div>
The second page which I copied from index.php and changed a few minor fields:
<!DOCTYPE HTML>
<html>
<head>
<title>324 SQN Canteen Manager</title>
<link type="text/css" rel="stylesheet" href="style_index.css"/>
<link type="text/css" rel="stylesheet" href="style_addstock.css"/>
</head>
<body>
<div class="header">
<img src="images/aafclogo.png" class="aafclogo">
<h3>Add Stock</h3>
</div>
<div class="buttonContainer">
<a href="index.php"><div class="button">
<p>Home</p>
</div></a>
</div>
Just to give you an example, the background colour of the second page is white, not the colour specified in the CSS file.
Where am I going wrong? Thanks.
You are having the problem because you never linked
style_common.css
to the second page. Instead you have
<link type="text/css" rel="stylesheet" href="style_index.css"/>
<link type="text/css" rel="stylesheet" href="style_addstock.css"/>
FIX:
add
<link type="text/css" rel="stylesheet" href="style_common.css"/>
to the second page.
The file location of the image is correct and it displays on localhost however doesn't online, how would i be able to get this to work?
I have tried changing the images from png to jpg and using different images and changing the file locations and then updating that on the code however it still does not display the image
<!DOCTYPE HTML>
<html>
<head>
<title>KMS</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="UTF-8">
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript" src="http://s.sharethis.com/loader.js"></script>
</head>
<body id="wrapper">
<div id="header">
<!--Logo-->
<div id="Logo">
</div>
<!--Logo-->
<!--Menu Buttons-->
<?php include 'menu.php';?>
<!--Menu Buttons-->
</div>
<div id="hContent">
<!--Frames--====================================================================-->
<div id="hFrames">
<!--Information go below-->
<div id="infoCon1">
<img id="kms_img" src="Images/Kmsproductsinformation.jpg" style="width:850px;"/>
<b />
<b />
</div>
<!--Information end-->
</div>
</div>
</div>
<!--
footer
-->
</body>
</html>
Try <img id="kms_img" src="images/kmsproductsinformation.jpg" style="width:850px;"/> and ensure that your images directory and kmsproductsinformation.jpg file are in lowercase.
You've got something funny going on with your DIVS. You have what looks like two additional close DIV tags () towards the end of your file - I'd start by fixing those up.
Having said that it also shouldn't really matter if it's localhost or not, or whether it's jpg or png but PNG would be better if you're setting it to a non-100% width.
Try something basic without all the DIVS or your menu.php file and see if that works.
<!DOCTYPE HTML>
<html>
<head>
<title>KMS</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="UTF-8">
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript" src="http://s.sharethis.com/loader.js"></script>
</head>
<body id="wrapper">
<img id="kms_img" src="Images/Kmsproductsinformation.jpg" />
</body>
</html>
Hi i had an issue reported for my script (https://github.com/joshf/Indication/issues/6) about echo statements printing rather than excecuting
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Indication</title>
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="resources/bootstrap/css/bootstrap.css" type="text/css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 60px;
}
</style>
<link href="resources/bootstrap/css/bootstrap-responsive.css" type="text/css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<!-- Nav start -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#">Indication</a>
</div>
</div>
</div>
<!-- Nav end -->
<!-- Content start -->
<div class="container">
<div class="page-header">
<h1><? echo WEBSITE; ?></h1>
</div>
<div class="alert alert-error"><h4 class="alert-heading">Error</h4><p>ID cannot be blank.</p><p><a class="btn btn-danger" href="javascript:history.go(-1)">Go Back</a></p></div></div></body></html>
Notice the echo WEBSITE
The PHP code is
die("<div class=\"alert alert-error\"><h4 class=\"alert-heading\">Error</h4><p>ID does not exist.</p><p><a class=\"btn btn-danger\" href=\"javascript:history.go(-1)\">Go Back</a></p></div></div></body></html>");
!
Is this a code issue or a configuration issue, im unable to reproduce it
This is probably because you are using php short tag <?..?>. Please avoid using them and switch to long one <?php....?>
Probably you have turned off short tags in the server.
It is not a good idea to use
<? /* something */ ?>
<?=echo $something;?>
Because in some servers short tags are disabled.
Try:
<?php echo WEBSITE; ?>