Jump to content

PHP website displays on web server but only text shows on local testing server


mikeskinner

Recommended Posts

Hi,  I am not a PHP programmer.

 

I took on a new client with a simple PHP site, without any databases.

The site is up and running on the web.

I would like to get it running on my local machine for further development.

I have latest version of WAMP installed, running Apache version 2.2.11 and PHP version 5.3.0

I created a directory in the WAMP "www" project directory and it shows up there like it's supposed to when I browse to "localhost"

 

Problem:

 

The home page of website displays text but no, images, styles, footer, header, nav links, etc.

 

 

Here is the code for the home page:

 

<?
	define("NAV","home");
require_once('local/local.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>
    <title>TITLE</title>
    <meta name="keywords" content="">
    <meta name="Description" content="">

<? include("common/dochead.php"); ?>

    </head>

<body onLoad="<? include('common/preloads.php'); ?>">

<!-- ============================ main ============================= -->
<div id="main-frame"><div id="main" class="noCollapse">

<? include("common/sign.php"); ?>

	<div id="right-frame">

<? include("common/navigation.php"); ?>		

		<div id="content-frame">
			<div id="content">


				<h1>Welcome</h1>
				<p>This is the content area. This is the content area. This is the content area. </p>


			</div><!-- end content -->
		</div><!-- end content-frame -->

	</div><!-- end right-frame -->

	<div class="clearFloats"></div>

</div><!-- end main --></div><!-- end main-frame -->

<? include("common/footer.php"); ?>

   </body>
</html>

 

 

Any help would be greatly appreciated. I have spent many hours on this.

 

Regards

Link to comment
Share on other sites

Chances are your php.ini on your local server does not have short_open_tags enabled. Hence you cannot use <? when that is disabled. To fix it, either fix your code to use <?php instead of <? (which is the recommended method) or modify your php.ini file and change the short_open_tags to be enabled. (May require an Apache restart).

Link to comment
Share on other sites

Well that just goes to show that knowledge is power. Thanks for the quick response and for pointing me in the right direction. I accessed the PHP settings through the WAMP system tray icon and put a check mark next to "short open tag", and that took care of it. What a bunch of time I wasted. Wish i had posted here to start with :)

 

Best Wishes

Link to comment
Share on other sites

So this is a followup question. Now the site displays properly, however when I click the links, the browser pulls the pages from the web server and not the local server. If i manually type in the pages I want to view, they show now problem via local server . Ie : http://localhost/site/page2.php. It looks like the nav links are pointing to absolute URL's as apposed to relative.

 

When I look in the php nav fil , here is a snippet of what is see:

 

<!-- ============================== navigation ================================= -->
		<div id="navigation-frame"><div id="navigation">		

		<a href="teachers.php" onMous

 

How would I change the nav to root relative links and why were they set up this way in the first place? Any ideas?

 

 

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.