Welcome to Dream.In.Code
Become a PHP Expert!

Join 136,933 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,864 people online right now. Registration is fast and FREE... Join Now!




Problem with include()/require()

 
Reply to this topicStart new topic

Problem with include()/require(), I'm not sure why they are not loading

Realedazed
22 Mar, 2008 - 04:56 AM
Post #1

New D.I.C Head
*

Joined: 13 Mar, 2008
Posts: 26


My Contributions
Maybe I need to take a nap and look at this again. But, I swear that I copied everything correctly. I used a book and a tutorial from this site. I uploaded this and viewed it from my website, which runs the latest version of PHP and I also tried in locally while running XAMPP.

The problem is that the PHP isn't doing anything. Normally,(if I read right) if the require() didn't load, I'll get an error. I used on as my first code to see if it works or not. I didn't get an error at all and the content section loaded normally. Also, I thought that if you viewed the source code you would see HTML not php stuff.

I placed all the files in the root directory for my website. This maybe a question to email GoDaddy, but should I have uploaded them to the phpuploads folder, then redirected my includes?

Also, when I did it locally, I placed all the needed files in the htdocs folder.

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=iso-8859-1" />
<title>Welcome</title>
<link rel="stylesheet" type="text/css" href="bigsheet.css" />
</head>
<body>


<!--OPEN WRAPPER-->
<div id="wrapper">
<!--INSERT HEADER-->
  <? require("theheader.php") ?>
  
<!--INSERT MENU-->  
  <?php include("themenu.php") ?>
  
<!--OPEN CONTENT-->  
  <div id="content">
    <!--start content text-->    
    <h1>Hello World</h1>
    <p>Blah Blah Blah</p>
    
<!--INSERT FOOTER-->
    <?php include("thefooter.php") ?>
    
    
</div><!--CLOSE CONTENT-->    

      
</div><!--CLOSE WRAPPER-->

</body>
</html>

User is offlineProfile CardPM
+Quote Post

spearfish
RE: Problem With Include()/require()
22 Mar, 2008 - 07:38 AM
Post #2

Monkey in Training
Group Icon

Joined: 10 Mar, 2008
Posts: 746



Thanked: 2 times
Dream Kudos: 225
My Contributions
Perhaps GoDaddy doesn't support the shorthand PHP, and you need to do something like....
CODE
<?php include("header.php") ?>

User is offlineProfile CardPM
+Quote Post

spullen
RE: Problem With Include()/require()
23 Mar, 2008 - 05:07 PM
Post #3

D.I.C Regular
Group Icon

Joined: 22 Mar, 2007
Posts: 330



Thanked: 1 times
Dream Kudos: 50
My Contributions
try it with semicolons at the end of the statement:
CODE

<?php include("header.php"); ?>

User is offlineProfile CardPM
+Quote Post

Realedazed
RE: Problem With Include()/require()
24 Mar, 2008 - 10:31 AM
Post #4

New D.I.C Head
*

Joined: 13 Mar, 2008
Posts: 26


My Contributions
I've tried with and without the semicolon, with the full <?php ?> versus the shorthand <? ?> and still nothing.

I'm thinking its something else I didn't do. I'm using XAMPP, so maybe there's something I need to do to switch the PHP on, or something? I'm going to read up on that and on GoDaddy's PHP support when I get home from class. I just know its something I did wrong for it not to work on either.

Thanks smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 10:39PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month