Jump to content

Recommended Posts

Posted

Ok, I installed XAMPP on my computer so I can work with PHP, well, I must be doing something wrong, I have my menu, header and footer in the inc folder, but when I open the index.php all that shows up is what is in the index.php, the header, footer and menu .php do not show up. What am I doing wrong, the inc folder is in localfolder/xampp/inc and the index is in localfolder/xampp/inc/index.php Thanks

Posted (edited)
Did you run the batch file to start apache?

and then goto http://localhost/inc/index.php

 

the files have to be in or below the htdocs folder.

 

 

i started the program with the main program, I will try the batcdh file

 

when you say below, do you mean? Sorry for the newbie questions.

Edited by jayson
Posted (edited)

ok, I got that part, (now) but when I enter in //localhost/inc/ I get a index of the directory, does the index.php also go into the inc, folder..

 

 

Thanks Don.

Edited by TCH-Bruce
Posted

You should always use the batch file to start xammp and stop xammp. It does some nice orderly things like start/stop apache, mysql, etc.

 

The inc directory is where the files you want "included" go. When I've used xammp, I've placed all my html files in the html directory. (I've got xammplite, so I don't know if there is a significant difference or not between the two.)

Posted

Thank you all for your wonderful help, I was up till 2:30 last night, and for some reason, nothing that I did would work, Apache is running, the files are where they are supose to be, but no matter what I tried, all I could get to show was just the index file. Not sure what version of XAMPP I have, but I think I am going to give up.

Posted

Ok, I have decided to give this another try, I got to see what or where I went wrong in the xampp setup and running, maybe it is the placements of the files, I just do not know, but I will try to figure it out.

Posted

Since you can see the contents of index.php, and it does not appear to be including the include files, it is probably a problem with your code in index.php. Post the contents of index.php here and I'm sure we can figure it out. Use the "Wrap in code tags" button when you post it.

Posted

the file I am trying to look at, is the same as my person site, www.jaysarahandy.com but I can not get it ot work on my computer using xampp.

 

But here is the code to make it easier for you.

 

<!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 NAME="Generator" CONTENT="Stone's WebWriter 3.5">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Andy's Web Site</title>

<link rel="stylesheet"href="as.css">

<style>

html {height:100%;}

* html #wrap {height:100%}

</style>

 

</head>

 

<body>

 

<div id="wrap">

<div id="header">

 

<!-- Starting Header Include -->

<div>

<div style="width:100%; font-size:36px; color:purple" align="center">My son's Site</div>

</div>

<!-- Ending Header Include -->

</div>

 

<div id="menu">

<!-- Starting Menu Include -->

<TABLE BORDER="0" ALIGN="center">

 

<TR>

<TD><a href="index.php">Home</a><br>

<a href="http://www.jaysarahandy.com/photos">Photo Gallery</a><br>

<!-- <a href='salem.php'>Headstones</a><br> -->

<a href='ai.php'>andy's Initials</a><br>

<a href='ohandy.php'>Oh Andy</a><br>

<a href="events.php">Events</a><br>

<a href='growth.php'>Growth Chart</a><br>

<a href='death.php'>Death</a><br>

 

<a href='ft.php'>Family Tree</a><br>

<a href='ah.php'>Hieroglyphs</a><br>

<a href='newsletter.html'>Newsletters</a><br>

<a href='gen/index.php'>Genology</a><br>

<a href='bc/index.php'>Birthday Cronicle</a><br>

<a href='zodiac.php'>Zodiac info about Andy</a><br>

(COMING SOON) Crossword Puzzle<br>

</TD>

</TR>

</TABLE>

 

<!-- Ending Menu Include -->

</div>

 

<div id="main">

<table>

<tr>

<td valign="top"> In loving of a pet that is now departed.<br>

Rasputin:<br>

Born: ?/?/1992 (adopted from a shelter)<br>

 

Adopted: 10/2/1995<br>

Passed away: 11/25/2006<br></td>

<td>

<img src="rasputin.jpg"></td>

</tr>

</table>

 

<TABLE BORDER="0" ALIGN="center">

<TR VALIGN="top">

<TD>

We are always changing what's here on the site <br>

so you will have to visit often. <br>

 

We hope you enjoy your visit. <br>

<p>

Sarah and Jay Yates of St. Paul, Minn.<br>

announce the birth of a son,<br>

Andrew Nikolai DeWitt Yates,<br>

born July 31, 2003,<br>

at Fairview Hospital in Minneapolis, Minn.<br>

He weighed 8 pounds, 15 ounces<br>

<p>

Grandparents are Cheryl Osgood & Terry Worrell of Tigard, Ore.<br>

 

Grandparents are Jerrie & Jim Penn of Coon Rapids, Minn.<br>

Great-grandparents are Virgil & Olivia Mack of Eagan Minn.<br>

Great-grandparents are DeWitt and Betty Osgood of DeKalb Ill.<br>

<p>

<p>

Birthday Tree:<br>

<B>Andy:</B><br>

Cypress <br>

The Faithfulness. Strong, muscular, adaptable, <br>

 

takes what life has to give, happy content, optimistic, <br>

needs enough money and acknowledgment, hates loneliness, <br>

passionate lover which cannot be satisfied, faithful, <br>

quick-tempered, unruly, pedantic and careless.<br>

<p>

<B>Sarah:</B><br>

Cedar <br>

The Confidence. Of rare beauty, knows how to adapt, <br>

likes luxury, of good health not in the least shy,<br>

 

tends to look down on others, self-confident, determined, <br>

impatient, wants to impress others, many talents, industrious,<br>

healthy optimism, waiting for the one true love, able to make quick decisions.<br>

<p>

<B>Jay:</B><br>

Elm <br>

The Noble-Mindedness. Pleasant shape, tasteful clothes, <br>

modest demands, tends to not forgive mistakes, cheerful, <br>

likes to lead but not to obey, honest and faithful partner, <br>

 

tends to a know-all-attitude and making decisions for others, <br>

noble-minded, generous, good sense of humor, practical.<br>

</TD>

</TR>

</TABLE>

 

</div>

 

 

<div id="clearfooter"></div>

 

<div id="footer">

<!-- Starting footer Include -->

<div style="width:100%; font-size:12px; color:

purple" align="center"><pre>

 

©2005/2007 ® to the yates family <a href="http://www.totalchoicehosting.com" target="blank"><font color=black>Hosted by Total Choice Hosting</font></a></pre>

</div> <!-- Ending footer Include -->

</div>

 

</div>

</div>

</body>

</html>

Posted

and this is the one that is on my computer:

 

<!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 NAME="Generator" CONTENT="Stone's WebWriter 3.5">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Andy's Web Site</title>

<link rel="stylesheet"href="as.css">

<style>

html {height:100%;}

* html #wrap {height:100%}

</style>

 

</head>

 

<body>

 

<div id="wrap">

<div id="header">

<!-- Starting Header Include -->

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

<!-- Ending Header Include -->

</div>

 

<div id="menu">

<!-- Starting Menu Include -->

<?php include("inc/menu.php"); ?>

<!-- Ending Menu Include -->

</div>

 

<div id="main">

<table>

<tr>

<td valign="top"> In loving of a pet that is now departed.<br>

Rasputin:<br>

Born: ?/?/1992 (adopted from a shelter)<br>

Adopted: 10/2/1995<br>

Passed away: 11/25/2006<br></td>

<td>

<img src="rasputin.jpg"></td>

</tr>

</table>

 

<TABLE BORDER="0" ALIGN="center">

<TR VALIGN="top">

<TD>

We are always changing what's here on the site <br>

so you will have to visit often. <br>

We hope you enjoy your visit. <br>

<p>

Sarah and Jay Yates of St. Paul, Minn.<br>

announce the birth of a son,<br>

Andrew Nikolai DeWitt Yates,<br>

born July 31, 2003,<br>

at Fairview Hospital in Minneapolis, Minn.<br>

He weighed 8 pounds, 15 ounces<br>

<p>

Grandparents are Cheryl Osgood & Terry Worrell of Tigard, Ore.<br>

Grandparents are Jerrie & Jim Penn of Coon Rapids, Minn.<br>

Great-grandparents are Virgil & Olivia Mack of Eagan Minn.<br>

Great-grandparents are DeWitt and Betty Osgood of DeKalb Ill.<br>

<p>

<p>

Birthday Tree:<br>

<B>Andy:</B><br>

Cypress <br>

The Faithfulness. Strong, muscular, adaptable, <br>

takes what life has to give, happy content, optimistic, <br>

needs enough money and acknowledgment, hates loneliness, <br>

passionate lover which cannot be satisfied, faithful, <br>

quick-tempered, unruly, pedantic and careless.<br>

<p>

<B>Sarah:</B><br>

Cedar <br>

The Confidence. Of rare beauty, knows how to adapt, <br>

likes luxury, of good health not in the least shy,<br>

tends to look down on others, self-confident, determined, <br>

impatient, wants to impress others, many talents, industrious,<br>

healthy optimism, waiting for the one true love, able to make quick decisions.<br>

<p>

<B>Jay:</B><br>

Elm <br>

The Noble-Mindedness. Pleasant shape, tasteful clothes, <br>

modest demands, tends to not forgive mistakes, cheerful, <br>

likes to lead but not to obey, honest and faithful partner, <br>

tends to a know-all-attitude and making decisions for others, <br>

noble-minded, generous, good sense of humor, practical.<br>

</TD>

</TR>

</TABLE>

 

</div>

 

 

<div id="clearfooter"></div>

 

<div id="footer">

<!-- Starting footer Include -->

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

<!-- Ending footer Include -->

</div>

 

</div>

</div>

</body>

</html>

Posted

Paths are a litte harder in xampp because it uses the root folder

Which is why I generally put all the files in one folder below htdocs.

Lets say I call the folder site1

 

Then I send the browser to htpp://localhost/site1

My includes are in the same folder,

so for my index.php file I use a simple include

 

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

 

So if all your files are in the same folder that will work.

 

But if your includes are in another folder below

as in site1/inc

then use

 

><!-- Starting Header Include -->
<?php include("inc/header.php"); ?>
<!-- Ending Header Include -->

 

 

So where is the index.php file located and where are the includes?

Posted

Also I see you are adding all the html code in each page

normally that is part of the header and footer

my template looks like this

 

><?php
// add header and additional title
$page_title="home"; 
include('header.php');
	  
// begin main content 
?>

<h2> <?php echo $page_title; ?> </h2>

<p>content</p>

<?php
// end main content 

// add footer file 
include("footer.php");
?>

 

The header has all the html up to the content

and the footer has all the html after the content.

That way I can change the layout with just two files.

Posted

Ok lets see if I can explain this, my site folder is at:

 

K:\xampp\htdocs\jsa

^^^^^

localhost

 

the index.php is in the jsa folder

 

my INc folder is at:

 

K:\xampp\htdocs\jsa\inc

^^^^^

localhost

 

so is that right or wrong.

 

I remermber having this problem before, and working it out.

Posted
my INc folder is at:

 

K:\xampp\htdocs\jsa\inc

 

You inc folder is already in the jsa folder

 

 

 

Try putting all the files in the jsa folder

and link to the includes as

<?php include ("filename"); ?>

Posted (edited)
Start reading your original post from that point down and you should get it sorted out.

 

 

finally got it to work, thanks Don and Bruce , you're are the best, you deserve a raise!!!! :tchrocks: :tchrocks: :tchrocks: :tchrocks: :tchrocks:

 

also, I was using my browser to open the file, and it does not like that...So I type it in manually

Edited by jayson
Posted

Good

now think about putting all the html but the content in your header and footer files

to save space and make it easier to modify the look of the site.

See my template above.

Posted

I will try, I am just learning this PHP stuff, and what little I have done took me a long time. but I will try to change the coding..Thanks Don

Posted

Glad to see you got this worked out! Just keep your trying small by making small changes to see what happens. Before long, you'll find that you'll be figuring things out easily enough!

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...