homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Script example on PHP parsing

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

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)


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)


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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved