Solved

Execute one PHP file from another

Posted on 2004-09-18
3
430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

696 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