dublinmike

msg:4040184 | 5:14 pm on Dec 9, 2009 (gmt 0) |
ob_start, ob_get_contents and then preg_replace should do the trick!
|
dr_jAcKaSS

msg:4044100 | 1:43 pm on Dec 16, 2009 (gmt 0) |
So if I run the following code, what I'm going to get in $string is going to be just HTML (php scripts will be executed)? I will not find any "<?php" in there, will I? $string = get_include_contents('statusi_dijakov.html'); //echo $string; function get_include_contents($filename) { if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); return $contents; } return false; }
|
CyBerAliEn

msg:4044168 | 3:44 pm on Dec 16, 2009 (gmt 0) |
Your function appears to do what you want. Given the filename, your function will include the file. It will process any and all PHP. And what gets outputted will get "caught" by the output buffering. This is then returned from the function. So what you get out of your function is the output of your PHP file, which in your case should be pure HTML. Once you have this HTML in the variable "string", you can further parse/manipulate it or output it to the user. Since you want to add PDF images to the front of PDF links, you can then add code to loop through the HMTL content looking for PDF links and inserting the image code into the original string. This will require some minimal thinking to setup the coding, but is relatively simple.
|
dr_jAcKaSS

msg:4045371 | 9:43 am on Dec 18, 2009 (gmt 0) |
Thanks so much! I think there shouldn't be many problems with further parsing of the string. I was just not sure about the first part (capturing the output of included file/-s).
|
g1smd

msg:4045886 | 12:33 am on Dec 19, 2009 (gmt 0) |
Do measure the performance when using this. How long does it take from browser request, to page starting to be rendered on screen, both with and without the additional function running?
|
|