LocalHost shows blank page. I changed port to 80 for Apache and when I press open page, it goes to localhost/mamp just fine. When I delete /mamp, all I get is a blank page. I've tried multiple things like shutting down mamp, starting it up, restarting my machine. I've checked my folder set-up and it's fine.
I tested it by creating a new file page index.html and it opens just fine.
I have no clue why it's not opening my index.php file. Here's my block of php code from header.php that I have.
<html>
<head>
<title><?php echo $pageTitle; ?></title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
And here's my index.php
<?php
$pageTitle = "A store of unique t-shirts";
include('inc/header.php');
?>
Any help would be appreciated.
Anything between <head> and </head> shouldn't show up on the page, so maybe try adding some content that would be printed on the page. For example, you could change header.php to this just to see if anything shows up:
<html>
<head>
<title><?php echo $pageTitle; ?></title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<p>Hello, this is content.</p>
</body>
</html>
Related
It's a weather reporting web-page. Just to see what I can do. There are three iframes,
The first includes a listing of some of the parameters in an JSON file from an API. I works just the way I expected.
The second is a chart of data - a different API call from the first one. No problems there.
The third will be forecast data, but the PHP code in the file is ignored! Every time!
This is the code (I've shortened it by eliminating the formatting and printing):
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style/weather.css" />
<title>The Weather Report</title>
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" type="text/css" href="./css/Florida.css" />
</head>
<body>
<?php
print "ready";
$forecast = get_web_page("http://api.weatherstack.com/current?access_key=1a134310341ff3b6fadb73bd1967baca&query=34232");
print $forecast;
$arrWeather = json_decode($forecast, true);
?>
</body>
</html>
All the HTML shows in wheen I view the age source"
<html>
<head>
<link rel="stylesheet" type="text/css" href="./style/weather.css" />
<title>The Weather Report</title>
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" type="text/css" href="./css/Florida.css" />
</head>
<body>
ready
That's it! The API request works perfectly when I plug it directly into the browser.
today I started some boilerplate project. I am using gulp to output minified css from SASS. I have two .css files - normalize.css and main.css. Both of them are minified from the same directory. When I am starting localhost with XAMPP I open index.php it could not load main.css but normalize.css is loaded. I get the following in console:
Also when I go to see files that are in localhost directory I see that main.css is there, but when I click on it it says that it could not found this file - error 404 and in url bar I see that it added "/" at the end of main.css - strange behaviour:
However when I open this index.php in Firefox everything is fine and both styles are loaded and displayed correctly. Here is index.php code if needed:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="" />
<meta name="keywords" content="">
<title>Title of site</title>
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="./dist/css/normalize.css">
<link rel="stylesheet" type="text/css" href="./dist/css/main.css">
<!-- FavIcon -->
<link rel="icon" type="image/png" href="//" sizes="32x32">
<!-- Fonts -->
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700' rel='stylesheet' type='text/css'>
<!-- JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- Local -->
<!-- <script src="./js/jquery.min.js"></script> -->
</head>
<body>
<h1>Hello wosfsdfsdfrld!</h1>
<p>scss and sass</p>
<p><?php echo('THIS IS HEADERsfsfsdf'); ?></p>
<img src="./img/testimg.png">
<script type="text/javascript" src="./dist/js/app.js"></script>
</body>
</html>
So it seems that it is somehow related to Chrome Browser, what could be an issue? Maybe some XAMPP config? But I have never touched it
The problem was name of folder containing project "siteStarter-php" caused some conflicts - changed it to "siteStarterPhp" and everything is working
I have added an availability calendar to my website which I found online, the header tags are below:
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/dateTimePicker.css">
<script type="text/javascript" src="scripts/components/jquery.min.js"></script>
<script type="text/javascript" src="scripts/dateTimePicker.min.js"></script>
When I add them to my current website page, it changes the template and ruins the look by either adding blank white space at the top of the page or affecting the nav bar whenever I add the script? Any ideas how I can have the script without it affecting my template?
Here is my template html with the script added...
<!DOCTYPE HTML>
<html>
<head>
<link rel="stylesheet" href="assets/style.css">
<title>Dave's Caravan Letting</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href='http://fonts.googleapis.com/css?family=Rochester' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="assets/style.css">
<link rel="stylesheet" href="assets/dateTimePicker.css">
<script type="text/javascript" src="scripts/components/jquery.min.js"></script>
<script type="text/javascript" src="scripts/dateTimePicker.min.js"></script>
</head>
By adding random code to existing code can cause code conflict, first understood the existing css code and than add the additional css code.
If you want to debug then open the site in browser's developer tool, check out the portion's css using inspect element and correct or rectify the css code.
Use the following link to learn how to use developer tool
https://developer.chrome.com/devtools
I'm trying to connect my PHP header from a file that is in a folder.
I'm attempting to do this by using:
<?php include("../header.php"); ?>
It works to bring the content in that file on the page, but its not applying the style.css file to the doc. Why?
Here is the contents of header.php:
<!DOCTYPE html>
<html>
<head>
<title>%TITLE%</title>
<link href='http://fonts.googleapis.com/css?family=Lilita+One' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="includes/normalize.css">
</head>
<body>
<header>
<div class="page-wrap">
<h2 id="logo">Some Company</h2>
<nav>
Home
Contact
Rentals
For Sale
</nav>
</div>
</header>
<section id="mainContent">
This is probably because its trying to reference the css at 'style.css' but try putting '../style.css'. It should allow the styles but it won't fix all your pages. In that case its better to use something like this:
<?php
// Set a constant with your url
define('BASE_URL', 'http://localhost:64411/TestingPHPStuff/');
echo 'Now use it in your html like this:';
?>
<link rel="stylesheet" type="text/css" href="<?=BASE_URL;?>style.css"/>
That way file location does not matter.
Basically though, you are trying to use a stylesheet that doesn't exist at that current level. Probably.
Edited
I changed it. If you include the 'http://' and the port ':64411' (for example you would use your port) then it should work. I just tested it and it only worked for me with both 'http://' and ':64411'.
I'm doing a project where I am using Media queries for responsive design.
I have 4 media queries in total.
On computer, when I resize the browser I pass for all my media queries, its working perfectly.
On smartphone I dont understand why, I'm not getting any css.
Even if I do in my stylesheet outside media queries *{display: none;}, on my smartphone
the content appears.
Do you have any idea why this can be happening?
I have an index.php file where I do my css and js imports, and I have a function HomePage() that calls my homepage.
?php
ob_start(); session_start();
require_once('code/db.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="device-width, initial-scale=1, maximum-scale=1" />
<title>Untitled Document</title>
<link rel="icon" type="image/png" href="<?php setHome();?>/template/images/icon.png" />
<link href="<?php setHome();?>/template/css/styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<?php setHome();?>/template/fonts/fonts.css" />
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="<?php setHome();?>/template/acc/css/jquery-ui-style.css" type="text/css" />
<script type="text/javascript" src="<?php setHome();?>/template/js/jquery.js"></script>
<script type="text/javascript" src="<?php setHome();?>/template/js/scripts.js"></script>
<?php
HomePage();
?>
My setHome function:
function setHome(){
echo 'http://localhost/website';
}
If I import my css like this it works:
<link href="template/css/styles.css" rel="stylesheet" type="text/css" />
But Like this dont works: (But works on computer)
<link href="http://localhost/website/template/css/styles.css" rel="stylesheet" type="text/css" />
Like this also dont works: (But works on computer)
<link href="<?php setHome();?>/template/css/styles.css" rel="stylesheet" type="text/css" />
If that's your actual code, the answer is pretty straightforward
http://localhost
Will work on your computer, but when you access it from your phone, it's going to try to connect to the localhost i.e. the phone instead of the computer - you need to put your actual hostname or IP address in there instead.