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
mantrax
Forum Newbie
Posts: 5 Joined: Sun Sep 19, 2004 5:58 am
Location: Italy - Asolo (Treviso)
Post
by mantrax » Sat Oct 09, 2004 1:59 pm
I have need of a script formatting a string containing HTML code
example:
string:
"<html><head><title>example</title></head><body>body</body></html>"
output:
Code: Select all
<html>
<head>
<title>example</title>
</head>
<body>
body
</body>
</html>
How i can do?
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Sat Oct 09, 2004 2:15 pm
Are you going to be doing this regularily to code entered into a CMS (or something like that) or are you just trying to tidy your own code?
Mac
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Sun Oct 10, 2004 6:13 am
Cool, hadn't realised they'd ported HTML tidy to PHP.
Mac
mudkicker
Forum Contributor
Posts: 479 Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:
Post
by mudkicker » Sun Oct 10, 2004 6:15 am
yeah i learnt it 2 days ago while searching in zend.com
mantrax
Forum Newbie
Posts: 5 Joined: Sun Sep 19, 2004 5:58 am
Location: Italy - Asolo (Treviso)
Post
by mantrax » Mon Oct 11, 2004 1:09 pm
How is used the tidy functions?
can you quickly explain it to me?
mudkicker
Forum Contributor
Posts: 479 Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:
Post
by mudkicker » Mon Oct 11, 2004 1:13 pm
Click on the link above and there's an example for it.I didn't use it before either..
mantrax
Forum Newbie
Posts: 5 Joined: Sun Sep 19, 2004 5:58 am
Location: Italy - Asolo (Treviso)
Post
by mantrax » Tue Oct 12, 2004 10:13 am
thanks much, tidy functions are very useful
phpScott
DevNet Resident
Posts: 1206 Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.
Post
by phpScott » Tue Oct 12, 2004 10:17 am
no tidy for php 4 that I can find
timvw
DevNet Master
Posts: 4897 Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium
Post
by timvw » Tue Oct 12, 2004 10:45 am
you can always use outputbuffering, let tidy clean (binary) clean the output, and then spit out that cleaned up html