Author Topic: PHP website displays on web server but only text shows on local testing server  (Read 2750 times)

0 Members and 1 Guest are viewing this topic.

Offline mikeskinnerTopic starter

  • Irregular
  • Posts: 6
    • View Profile
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

Offline premiso

  • Karma Chameleon
  • Staff Alumni
  • Freak!
  • *
  • Posts: 6,670
  • Gender: Female
  • effing right
    • View Profile
    • PHP Help
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).

Offline mikeskinnerTopic starter

  • Irregular
  • Posts: 6
    • View Profile
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

Offline mikeskinnerTopic starter

  • Irregular
  • Posts: 6
    • View Profile
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?





« Last Edit: February 16, 2010, 01:57:26 PM by mikeskinner »