[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Execute one PHP file from another

Posted on 2004-09-18
3
Medium Priority
?
435 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 1000 total points
ID: 12093675
Hi majestikm00se,

Use include?

include("myfile.php");

Regards,
Zyloch
0
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 200 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

649 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