Jump to content

parsing a php file and then grabbing it's contents


envexlabs

Recommended Posts

Hello,

 

I have a modal window that appears, but it will only accept html files. No big deal, so i thought.

 

Is it possible to write a function that will render out a php file behind the scenes and grab all it's contents.

 

ie.

 

script.php

<?php echo 'This Works';

 

If i were to use fopen or get_file_contents nothing would show up.

 

I would like php to do it's magic and return "This Works".

 

Any ideas?

 

Thanks,

envex (matt)

Link to comment
Share on other sites

What you're looking for is eval.

 

http://us3.php.net/eval

 

I don't think it's working, i'm getting:

 

Parse error: syntax error, unexpected '<' in /nfs/c03/h04/mnt/57152/domains/wheresyourstore.com/html/test.php(5) : eval()'d code on line 1

 

The file i'm referencing is reference.php

 

my modal window will grab reference.php, but it won't parse any of the php because of the way it deals with javascript loading the content.

Link to comment
Share on other sites

Well, shit.

 

I was expecting the PHP file you uploaded to be purely php. In this case it has a mix of both?

 

Yeah, sorry it's been a long day of back and forth. The old brain is a bit fried.

 

The reference file has no syntax errors, when i view it by itself it renders everything fine.

 

This stupid modal box is causing a major headache, and of course it's on a friday :P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.