Jump to content

Recommended Posts

Hello guys,

 

I need help. I'm building a "simple" template function that grab an html file containing custom markups and string_replace them with the information it collects as for example title of the page, title of the website, etc...

 

I'm stuck at the last markup which is {_PAGE:CONTENT_}. What happen is I parse the content of the page through a file_get_contents("page.html") and i put the resultant string in a variable i will call $pcontent then I string_replace the markup with $pcontent and voilat... this works great with an HTML page but of course I can't do it with a page.php cause the output needs to be processed server side first.

 

My question is: is there a method I can parse the html code resulting from that php page and put it into a variable to replace it to the markup???

 

I'm sure I can somehow... HELP :P

 

Thanks.

Well, you should really include the file into your script.  That way the PHP parser will parse it.  You, of course, would have to set the variable somewhere in that script.

 

The sloppy work around would be to put a full registered protocol (URL) into file_get_contents(), if fopen wrappers are enabled, then it will parse the data and return it.

thanks for the reply... yes I thought myself about the sloppy workaround but it's really... sloppy! :D

 

 

I think I will have to work on the php file apparently... Even though it's weird I can't find a script or something that does something like that...

 

Thanks again anyways.

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.