Jump to content

[SOLVED] PHP from HTML?


ravix76

Recommended Posts

I've created a dynamic site using PHP and MYSQL which is working great. To save server load, I have an admin feature that dumps all the pages (static) to HTML for browsing. However, on the dynamic site, I have a php include with checks IP Address and records a hit if it is unique. As the HTML dumping simply reads the source of the outputted dynamic page and dumps to HTML, the IP Addresd feature doesn't work.

 

Is there a way to call a PHP Include from HTML or do I need to dump all the static pages to php instead?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/59961-solved-php-from-html/
Share on other sites

Ok. I'm now outputting static files to filename.php using the following...

 

$staticpagedata = file_get_contents($sourcepage);

 

and then writing to a file. Thus $staticpagedata contains the outputted source of the page and not the dynamic source eg

 

<-- Stats Start-->

Static PHP outputted to browser (ie not dynamic)

<--Stats End-->

 

What I then want to do is replace all data in the $staticpagedata between "<--Stats Start-->" and "<--Stats End-->" with "<?php virtual('/stats.php'); ?>"

 

In Summary Is there an easy way to cut / replace "EFG" from string "ABCDEFGHIJ" when you know point "D" and "H" but EFG might not always be EFG.... ie I can't use "Str_replace" because I don't know what I'll be replacing"

 

erm... hope that makes sense! 

Many thanks!

Link to comment
https://forums.phpfreaks.com/topic/59961-solved-php-from-html/#findComment-298271
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.