1

I've gone through the archives and read a bunch of questions relating to why PHP include won't work. I've tried to fix my problem using answers to the other questions, but am still having issues.

This is my code:

<!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" />
<title>Fuel Status Map</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="main">
    <div id="map">
    <?
    require 'MapLink.php';
    ?></div>
    <div id="title"><img src="title.png" width="400" height="200" />
    </div>
    <div id="links">

    <a href="statusbyzone.php"><img src="FuelStatusLink.png" width="400" /></a>

    <br />
    <a href="selectoffice.php"><img src="NWSofficeLink.png" width="400" /></a>
    <br />
    <a href="Login1.php"><img src="FuelSpecialistLink.png" width="400"  /></a>
    <br />
    <img src="AdminLink.png" width="400" />
    <br />

    </div>
    <div id="legend"><img src="Legend1.png" width="400">
    </div>
    <div id="logos">
    <img src="PSlogo.png" width="140" height="150" />
    <img src="GBlogo.png" width="250" height="150"/>
    </div>
</div>
</body>
</html>

The page is supposed to look like this: http://www.directdocuments.com/GACC/GBSite/predictive/FuelStatus/FuelStatusMap.php but looks like this: http://gacc.nifc.gov/gbcc/predictive/FuelStatus/FuelStatusMap.php The MapLink.php is in the same directory, and works correctly. I'd post the link to that as well, but I can't post any more links.

1 Answers1

2

It looks like you don't have short open tags enabled in your PHP configuration, so the require line is being output literally (use View Source to see this). Use the full tag.

<?php 
require 'MapLink.php';
?>

From the documentation:

PHP also allows for short open tag <? (which is discouraged since it is only available if enabled using the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option).

See also Are PHP short tags acceptable to use?

Community
  • 1
  • 1
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Just to elaborate... This is fine, `= $someVariable ?>`. Short [tags](http://php.net/manual/en/language.basic-syntax.phptags.php) though are not. There should be plenty on the web about why short tags were/are frowned upon. – ficuscr Jul 01 '15 at 20:43
  • I didn't realize that there was a difference between and – Nanette Hosenfeld Jul 01 '15 at 20:49