php include unreliable

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
I tried the code and it worked for about 10 minutes then it stopped. I went through and made sure there was conflicts with the single quotes.
Code:
echo ' '

Still it doesnt work.

I am using the php to include external files written in html. Any suggestions about how to make this work more reliably?
 

tnl2k7

Banned
Messages
3,131
Reaction score
0
Points
0
I tried the code and it worked for about 10 minutes then it stopped. I went through and made sure there was conflicts with the single quotes.
Code:
echo ' '
Still it doesnt work.

I am using the php to include external files written in html. Any suggestions about how to make this work more reliably?

Use:

Code:
<?php
 include("path/to/file.html");
?>

Replacing path/to/file.html with the location of your file. Never use the full URL to a page when including a file with PHP, this won't work for security reasons.

-Luke.
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
First of all, echo is not to include files, echo just outputs a string. As tnl2k7 said, it's include. Second, every line in php HAS to be ended with a ";" (unless you're defining a block {} or such)
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
the echo ' ' function was not used to call the the file. It was:

Code:
<? php include "file.php";?>

In the file itself I used echo' ' to output the html.
Would I need to put ";" in the end of each line of code in the included file even if its html? If so how would I code in the "{}" to block all the html and avoid putting ";" at the end of each line?

Thanks a lot
 

jspcodes

New Member
Messages
60
Reaction score
0
Points
0
the echo ' ' function was not used to call the the file. It was:

Code:
<? php include "file.php";?>
In the file itself I used echo' ' to output the html.
Would I need to put ";" in the end of each line of code in the included file even if its html? If so how would I code in the "{}" to block all the html and avoid putting ";" at the end of each line?

Thanks a lot

Though i am not clear about the question. the half answer is
<?php
echo "<html><body><div id='ele1'>f.php</div></body></html>"; ?>

and name that as f.php

and include as

include "f.php";



Visit me at http://jspcodes.elementfx.com
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
I think you want this:
Code:
<html>
<body>
<div id='ele1'>
<? php include "f.php";?>
</div>
</body>
</html>
Assuming that "f.php" is in the same directory.
 

tnl2k7

Banned
Messages
3,131
Reaction score
0
Points
0
OK guys, can we wait for a reply from the original poster now? They only need one reply, sheesh!

-Luke.
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
Thanks for your help everyone. jspcodes, are you saying I should use echo " " instead of echo ' '? Seeing as I am using a lot of html in the external file, wouldnt using double quotes for the echo cause a lot of conflicts?

DeadBattery, is the <div> tag necessary to aid in calling the external file with php?

I have read that when creating the initial php code I should have no space between the <? and php. ie. <?php. Would this be true? Also how do go about knowing if short open tags are on?

Lastly is the ; required after every string of code within a php document, even if it is echoing html? If so how would I place brackets around all of it to avoid this if possible?
 
Last edited by a moderator:

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
Thank you for your help

I have tried everything you suggested, but it seems to still not work. Could this be a hosting issue or setting I need to change?

I currently have php v3 which I upgraded for this exact issue.

Is there anything else I should be aware of that would make this work again? If so please tell me how to go about changing, seeing as I am still learning x10's layout.

Thanks a lot in advance
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Have you tried
Code:
<html>
<body>
<?php include "f.php";?>
</body>
</html>
?

Also, can we have a look at "f.php"?
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
Does the file have to be called "f.php"? I named it "renavbar.php"

Here is the code for it:

Code:
[B]<div id="ele1">[/B]
[B]<?php 
[U]include[/U] "renavbar.php";
?>[/B]
[B]</div>[/B]

As for the file itself:

Code:
[B]<php 
[U]echo[/U] '
<html>[/B]
[B]<table width="100%" border="1">[/B]
[B]<tr>[/B]
[B]<td>[/B]
<!--main menu--!>
[B]<a href="index.html">[/B][B]<img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/home.png" onmouseover="rollOn([U]this[/U])" onmouseout="rollOff([U]this[/U])" id="home" vspace="1" hspace="0">[/B][B]</a>[/B]
[B]<a href="reforeclosure.html">[/B][B]<img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/foreclosures.png" onmouseover="rollOn([U]this[/U])" onmouseout="rollOff([U]this[/U])" vspace="1" hspace="0">[/B][B]</a>[/B]
[B]<a href="recompare.html">[/B][B]<img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/listings.png" onmouseover="rollOn([U]this[/U]); showMe(1)" onmouseout="rollOff([U]this[/U]); " id="hotspot" name="hotspot" vspace="1" hspace="0">[/B][B]</a>[/B]
[B]<a href="#">[/B][B]<img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/education.png" onmouseover="rollOn([U]this[/U]); showMe(2)" onmouseout="rollOff([U]this[/U]); " id="hotspot" name="hotspot" vspace="1" hspace="0">[/B][B]</a>[/B]
[B]<a href="#">[/B][B]<img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/products.png" onmouseover="rollOn([U]this[/U]); showMe(3)" onmouseout="rollOff([U]this[/U]); " id="hotspot" name="hotspot" vspace="1" hspace="0">[/B][B]</a>[/B]
[B]<a href="#">[/B][B]<img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/resources1.png" onmouseover="rollOn([U]this[/U]); showMe(4)" onmouseout="rollOff([U]this[/U]); " id="hotspot" name="hotspot" vspace="1" hspace="0">[/B][B]</a>[/B]
[B]<a href="resupport.html">[/B][B]<img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/support.png" onmouseover="rollOn([U]this[/U])" onmouseout="rollOff([U]this[/U])" vspace="0" hspace="1">[/B][B]</a>[/B]
[B]</td>[/B]
[B]</tr>[/B]
[B]</table>[/B]
[B]</html>[/B]';
?>

There is more inbetween the php tags, but its just a simple html table with <span> tags.

In another forum, people have mentioned:

making it strictly a html file that php calls

take out the <html> tag

take out the <?php?> and echo tags in the external file

I have also tried using single quotes when calling the file with php. ie. <?php include 'renavbar.php';?>

The one that did work for me momentarily is:

Code:
<?php include "renavbar.php";?>

keeping the <html> tags in the external file.
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
Here are some things I found wrong with what you were doing.
The PHP Include format should look like this:
PHP:
<?php include'blah.php' ?>

Also, the file you are trying to include should be an HTML file saved as a PHP file.
Don't try to echo the HTML or it will just display the text but not process the code.
This is what I did.

File #1: index.php
PHP:
<html>
  <head>
    <title>
      Test
    </title>
  </head>
  <body>
    <?php include'renavbar.php' ?>
  </body>
</html>

File #2: renavbar.php
PHP:
<html>
<body>
<table width="100%" border="1">
<tr>
<td>
<!--main menu--!>
<a href="index.html"><img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/home.png" onmouseover="rollOn(this)" onmouseout="rollOff(this)" id="home" vspace="1" hspace="0"></a>
<a href="reforeclosure.html"><img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/foreclosures.png" onmouseover="rollOn(this)" onmouseout="rollOff(this)" vspace="1" hspace="0"></a>
<a href="recompare.html"><img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/listings.png" onmouseover="rollOn(this); showMe(1)" onmouseout="rollOff(this); " id="hotspot" name="hotspot" vspace="1" hspace="0"></a>
<a href="#"><img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/education.png" onmouseover="rollOn(this); showMe(2)" onmouseout="rollOff(this); " id="hotspot" name="hotspot" vspace="1" hspace="0"></a>
<a href="#"><img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/products.png" onmouseover="rollOn(this); showMe(3)" onmouseout="rollOff(this); " id="hotspot" name="hotspot" vspace="1" hspace="0"></a>
<a href="#"><img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/resources1.png" onmouseover="rollOn(this); showMe(4)" onmouseout="rollOff(this); " id="hotspot" name="hotspot" vspace="1" hspace="0"></a>
<a href="resupport.html"><img src="http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/support.png" onmouseover="rollOn(this)" onmouseout="rollOff(this)" vspace="0" hspace="1"></a>
</td>
</tr>
</table>
</body>
</html>

Try that out.
I did that and got this: http://primatetech.pcriot.com/surreal/
Let us know how it works out. :)
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
sorry that didnt work either. I wish I was getting some error reporting to help out. But all I get is nothing, just the other regular code.

Is there a certain permission code I need to have this work for the php file I'm calling? That is only thing I havnt tried so far.
 

surreal5335

New Member
Messages
28
Reaction score
0
Points
0
yes
Edit:
I tried changing the include to require instead to help promote some error reporting, that didnt change anything either. It seems its not even reading like its ignoring the code.

Any thoughts?
 
Last edited:
Top