include issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

include issue

Post by Vegan »

I am using an include statement and for some reason when I do that, the engine does a newline before showing the included material.

Seems to be a bizarre problem.

<?php include '/footer.html' ?>
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: include issue

Post by social_experiment »

Is there a new line inside the included file?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: include issue

Post by Vegan »

nope, just HTML5
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: include issue

Post by Pazuzu156 »

I noticed you used:

Code: Select all

<?php include "/footer.php"; ?>
If you include a / then use ./

Example:

Code: Select all

<?php include"./footer.php" ?>
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
User avatar
egg82
Forum Contributor
Posts: 156
Joined: Sat Oct 01, 2011 9:29 pm
Location: Colorado, USA

Re: include issue

Post by egg82 »

or simply don't use "./" or "/" at all...

Code: Select all

<?php include "footer.php"; ?>
User avatar
Vegan
Forum Regular
Posts: 574
Joined: Fri Sep 05, 2008 3:34 pm
Location: Victoria, BC
Contact:

Re: include issue

Post by Vegan »

I found that changing the included file fixed the problem

content was on 1 line, changed it to multiline and it worked, go figure
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
Post Reply