bmxpert
02-20-2002, 07:00 PM
Hello,
My site, http://www.bmxgrind.com was redone in Php a while back and I have had a problems with the index.php file. The script adds blanks spaces in between lines and I have seen up too 7 spaces inbetween the lines. Example:
<? blah blah bla
echo; nunah la lue
blah more blah ?>
You get the point. But why on earth is is it doing this? I thought I knew how to fix it, I made a text file called bmxgrind.txt and inside of it was the code for index.php . The only thing on index.php was a include statement that called that file. It worked but all of a suden my site went down. After I put the source into index.php it worked again. This is really bothering me, my site will load slower and use more bandwith this way. Is there a way to fix it?
MarcD
02-20-2002, 09:00 PM
perhaps post the two files here
is probably a simple code problem
will be easier to take a look at
bmxpert
02-21-2002, 06:40 PM
Will do. In a sec though.
bmxpert
02-21-2002, 06:45 PM
<!--Start of PHP content inserting -->
<?php
if ($action == "") {
require ("php/var/content.txt");
} else if ($action == "photos") {
if ($gallery == "") { require ("php/var/photos/$action.txt"); } else { require ("php/var/photos/$gallery.txt"); }
} else if ($action == "interviews") {
if ($person == "") { require ("php/var/interviews/$action.txt");} else { require ("php/var/interviews/$person.txt"); }
} else if ($action == "howto") {
if ($how == "") { require ("php/var/howto/$action.txt"); } else { require ("php/var/howto/$how.txt"); }
} else if ($action == "reviews") {
if ($review == "") { require ("php/var/reviews/$action.txt"); } else { require ("php/var/reviews/$review.txt"); }
} else {
require ("php/var/$action.txt");
}
?>
<!--End of PHP content inserting -->
I just posted the php part of index.php To see the other part of the code, just read the source at bmxgrind.com
microsol
02-21-2002, 07:44 PM
I am tired after sitting 16 hours in front of the computer like always but try this one:
<?php
if ($action == "") {
include ("php/var/content.txt");
}
if (($action == "photos") && ($gallery == "")) {
include ("php/var/photos/action.txt");
} else {
include ("php/var/photos/gallery.txt");
}
elseif (($action == "interviews") && ($person == "")) {
include ("php/var/interviews/action.txt");}
else { include ("php/var/interviews/person.txt"); }
} elseif (($action == "howto") && ($how == "")) {
include ("php/var/howto/action.txt"); }
else { include ("php/var/howto/how.txt"); }
} elseif (($action == "reviews") && ($review == "")) {
include ("php/var/reviews/action.txt"); }
else {
include ("php/var/reviews/review.txt"); }
}
else {
include ("php/var/action.txt");
}
?>
heddesheimer
02-22-2002, 02:59 AM
you will get extra spaces in the PHP scripts if you change the operating system. For example: If you have created the script in a Unix/Linux environment and pass it over to Windows.
The reason is, that unix do use a CR/LF while Windows only usr CR, so some editors will interpret the CR (carriage return) as an extra LF (line feed).
You can avoid this if you use an editor that will not add the extra line. I use PHPEd and it works fine most times.
You can remove the extra spaces if you just use a search and replace in any editor and just replace the two linefeeds with just one.
Marian
Studio64
02-22-2002, 04:25 AM
Kinda an off-topic php question but...
I know this doesn't work but, is there another way to write the code to get it to work?
function IncludeMe($Name)
{
include($Name);
}
Anyone know of any work arounds?