Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embed PHP Help

Status
Not open for further replies.

syion

Technical User
Apr 3, 2002
1
CA
I am having a problem calling up a *.php file in side another *.php file

My server runs PHP 4

I can run the cal.php by calling it by it self (see link below)

When I try to include the cal.php in another page I get a bunch of errors. I
created a simple *.php file to call the cal.php in see link below
The cal.php file works just fine - see below


When I try and call the cal.php file up inside of the calendar.php file I
get all kinks of problems - can some one tell my why this is ?


thanks

Below is the script for the calendar.php which <includes> the cal.php file



<?php ?>
<meta http-equiv=&quot;Content-Language&quot; content=&quot;en-us&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;border-collapse:
collapse&quot; bordercolor=&quot;#111111&quot; width=&quot;200&quot; id=&quot;AutoNumber1&quot;>
<tr>
<td>
<?php include (&quot; ?>
</td>
</tr>
<tr>
<td> </td>
</tr>
</table>
 
what's the error you're getting?

if it says something like (cannot send headers), that's a session error. to get around it, add ob_start(); to the top of the page giving you problems. Otherwise, post the error and we'll see what we can do. leo

------------
Leo Mendoza
lmendoza@garbersoft.net
 
Try this instead - you dont wanna &quot;include&quot; or &quot;require&quot; files with absolute URLs, use the relative path. Also, you dont want the double semi-colon.
Code:
<?php include ('/forum/cal.php'); ?>

  or

<?php include ('forum/cal.php'); ?>

Good luck!

----------------------

BTW, you always wanna use single quotes (unless you are inserting a variable) - it's faster, because PHP doesn't have to scan through your string to see if there are an vars to evaluate and replace.

Example:
Code:
 <?php include (&quot;forum/cal.php&quot;); ?>
is slower than
Code:
 <?php include ('forum/cal.php'); ?>
Bacuse it searches for variables in the first. -gerrygerry
Go To
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top