Jump to content

Read half a file, parse PHP and display results


BrandonKahre

Recommended Posts

I have a unique situation where I need to be able to request a file (a template of my site actually), read it from <body> to <!-- ### ---> (non-inclusive), prase the PHP in between there, and display the results. After I do that I'll need to do the opposite: <!--- ### ---> to </body>

My first attempt at this gives me the straight code not parsed as PHP (the page I will be displaying this on, Miva shopping cart software, will not render PHP). I tried to use fopen and fgets.

Is there a better solution to this? I would like to avoid having to manually split the two files in half and including them that way, but if I do it that way, it will work. The problem with that is if I make changes to the template for my other pages, I have to manually copy the changes over to the second template pages.

Any ideas?

Thanks

Brandon
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.