Solved

Execute one PHP file from another

Posted on 2004-09-18
3
425 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

744 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

11 Experts available now in Live!

Get 1:1 Help Now