Solved

Execute one PHP file from another

Posted on 2004-09-18
3
426 Views
Last Modified: 2008-03-03
I currently have a webpage layout using 3 "frames" via PHP.  Each "frame" read from a separate HTML file and arranged like this:

TOP BANNER
----------------
 L |
 E | MAIN
 F | PAGE
 T |

I want to allow the "main page" to be a mix of HTML and PHP code.  I've tried readfile(), which outputs the HTML fine, but won't execute the PHP code. eval() only does one string/line at a time, and assumes everything is PHP code.  passthru() doesn't give me any output.
0
Comment
Question by:Adam Mason
3 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 250 total points
ID: 12093675
Hi majestikm00se,

Use include?

include("myfile.php");

Regards,
Zyloch
0
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 50 total points
ID: 12093716
Or possibly even require('myfile.php'); :-)
0
 

Author Comment

by:Adam Mason
ID: 12093718
son of a...

I thought I saw a way to do it a while back, but couldn't find it again on php.net
I was thinking it was like the C "#include"

Thanks for the quick answer.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now