Jump to content

Recommended Posts

So, we had a professional guy build a website for us a number of years ago, but updating the site with our provided info took a while and was fairly costly.  I got the ftp info and have been able to update the site fairly well for much cheaper since then.  Now, though, I'm trying to add new features and perhaps even change some of the more complex things that are on the site, and I really don't know much about it.  So, I've undertaken learning PHP.  I don't even know much HTML, so it will definately be interesting.

 

On my third attempt to get some sort of web server working (the second attempt might have worked, but I made a noob mistake and then uninstalled it all), I have gotten WAMP up on my Windows Vista machine.  Everything is pretty much the latest version.

 

I then downloaded all of the files off of my website and put them into the localhost directory.  The http://localhost/home.php link works, but none of the php code on the site works.  On home.php, there are two includes and a little program that determines if we are open or not, nothing real special.  Except none of the codes work.

 

So, I made a test.php and an includeme.php and those work fine.  Then I re-coded one of the includes on home.php and got it to work.  So, my question is this: what is the difference between the two codes below?

 

Not working on my localhost, works online:

<?
$page = "home.php";
include $_SERVER["DOCUMENT_ROOT"] . "/include/header.php";
?>

 

Working on my localhost, not tested online:

<?php include('include/header.php'); ?>

 

I'm sure he/they had a good reason for the way they did it, and I'm sure the whole $_server/documentroot garble has some sort of importance, but I sure don't know what it is.  I just don't like to go in and change things without knowing what I'm doing.

I don't follow.  What am I supposed to do with that?

 

I've been learning PHP for about 3 hours...  I recognize 'echo' but I don't know what the second thing you put up there is going to do.

 

EDIT: I think I'm starting to figure out at least what the commands are doing, but I don't know how I can make apache emulate it so it works without me having to edit every single file to point it to the correct path...

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.