how to strip some html tags from a file before including it?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
boom4x
Forum Newbie
Posts: 16
Joined: Mon Mar 08, 2004 2:10 pm
Location: New York, NY
Contact:

how to strip some html tags from a file before including it?

Post by boom4x »

Hello,
I know to include a file we use

Code: Select all

include('myfile.html');
Here is where im stuck: before file is displayed, it strips the following tags: <html> <head> <body> </body> </head> </html> out of the file.


I am using the FCK Editor (WYSIWYG) and it keeps adding those tags to my files which is annoying.

I thank anyone in advance that can help :D
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Regular expressions can remove them. Alternately, you could alter how the files are created removing them on that end. It will make execution faster in the end.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: how to strip some html tags from a file before including

Post by Kieran Huggins »

boom4x wrote:Hello,
I know to include a file we use

Code: Select all

include('myfile.html');
Here is where im stuck: before file is displayed, it strips the following tags: <html> <head> <body> </body> </head> </html> out of the file.
Maybe readfile() is what you're looking for.
boom4x wrote:I am using the FCK Editor (WYSIWYG) and it keeps adding those tags to my files which is annoying.
There's a setting for that in FCKeditor
Z3RO21
Forum Contributor
Posts: 130
Joined: Thu Aug 17, 2006 8:59 am

Post by Z3RO21 »

http://us3.php.net/striptags maby this could be of some use, just specify the tags you want to keep
Post Reply