Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Script example on PHP parsing



6:18 pm on Aug 17, 2002 (gmt 0)

10+ Year Member

Can someone post a quick example how to find a tag in an opened HTML file and insert a string right before it? For example, I want to insert '<base href="abc.com">' before the </HEAD> tag...

Also, I am using the require keyword to include an HTML file...is this the same thing as opening it? Can you modify a file when using require? The reason I ask is that I included an offiste HTML and the images did not show up properly...


11:36 pm on Aug 17, 2002 (gmt 0)

10+ Year Member


if you're adding the external HTML file to your template it won't work like that, you'll have to modify all its links.

You can't modify a file that's included with require, you'll have to use fopen [php.net].


3:23 am on Aug 18, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member


as far as your parsing goes, take a look at this.

preg_replace() [php.net]

I use this for parsing files and altering their content. It should do what you need to.


Featured Threads

Hot Threads This Week

Hot Threads This Month