471,306 Members | 917 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,306 software developers and data experts.

HTML Formatting

Hey

I have a class called page. This class outputs a page in html. Now I have a
function called OutPutHtml

This outputs html, however I want to be able to do this:

outputhtml('<body>
<something');

So I can keep it nice and formatted. But when I do this there are huge gaps
in the html. How can I do this so it formats it?

I hope you get what I mean.
Thanks

--
- Hayden Kirk
iXon LTD

123 Main Street,
Upper Hutt, Wellington,
New Zealand

Phone: +64 4 5279091
Fax: +64 4 5268123
Jul 17 '05 #1
5 1883
Hayden Kirk wrote:
I have a class called page. This class outputs a page in html. Now I have a
function called OutPutHtml

This outputs html, however I want to be able to do this:

outputhtml('<body>
<something');
Outputs
========
<body>
<something
========
So I can keep it nice and formatted. But when I do this there are huge gaps
in the html. How can I do this so it formats it?
Either do some reformatting inside outputhtml() (like stripping extra
spaces, extra lines, ...) or pass it a 'nicer' string:

outputhtml('<html>
<something');
I hope you get what I mean.


Not sure I did, hope so.

You're going to have a hard time trying to write 'nice' PHP that also
outputs 'nice' HTML.

My HTML is mostly very large lines with a "\n" here and there :)
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2
On 2004-02-27, Hayden Kirk <sp**@spam.com> wrote:
Hey

I have a class called page. This class outputs a page in html. Now I have a
function called OutPutHtml

This outputs html, however I want to be able to do this:

outputhtml('<body>
<something');

So I can keep it nice and formatted. But when I do this there are huge gaps
in the html. How can I do this so it formats it?


The easiest way, is not to care about identation of your tags in your
code. Use output buffering, run tidy to clean up the generated html,
and then output the lot.
--
http://home.mysth.be/~timvw
Jul 17 '05 #3
Hi

Thanks for the reply, can you explain this a bit more, I don't quite get
what you mean, or the functions your talking about.

Thanks

"Tim Van Wassenhove" <eu**@pi.be> wrote in message
news:c1*************@ID-188825.news.uni-berlin.de...
On 2004-02-27, Hayden Kirk <sp**@spam.com> wrote:
Hey

I have a class called page. This class outputs a page in html. Now I have a function called OutPutHtml

This outputs html, however I want to be able to do this:

outputhtml('<body>
<something');

So I can keep it nice and formatted. But when I do this there are huge gaps in the html. How can I do this so it formats it?


The easiest way, is not to care about identation of your tags in your
code. Use output buffering, run tidy to clean up the generated html,
and then output the lot.
--
http://home.mysth.be/~timvw

Jul 17 '05 #4
Hayden Kirk wrote:
"Tim Van Wassenhove" <eu**@pi.be> wrote in message
news:c1*************@ID-188825.news.uni-berlin.de...
(...)
The easiest way, is not to care about identation of your tags in your
code. Use output buffering, run tidy to clean up the generated html,
and then output the lot.

(...)
Thanks for the reply, can you explain this a bit more, I don't quite get
what you mean, or the functions your talking about.


Output buffering means, Your script does not output code until it has
finished. In php5, it is possible to have the output sent through Dave
Ragget's HTML Tidy which reformats and cleans Your HTML before it is
sent to the client. (Extension required)

Excellent option, if You already have php5 and the extension installed.
Anybody here has done this already?

I suppose the HTML better not be _too_ bad, otherwise I don't know what
Tidy might do.

Rudi
Jul 17 '05 #5
On 2004-02-27, Hayden Kirk <sp**@spam.com> wrote:
"Tim Van Wassenhove" <eu**@pi.be> wrote in message
news:c1*************@ID-188825.news.uni-berlin.de...
On 2004-02-27, Hayden Kirk <sp**@spam.com> wrote:
> Hey
>
> I have a class called page. This class outputs a page in html. Now I have a > function called OutPutHtml
>
> This outputs html, however I want to be able to do this:
>
> outputhtml('<body>
> <something');
>
> So I can keep it nice and formatted. But when I do this there are huge gaps > in the html. How can I do this so it formats it?
>
The easiest way, is not to care about identation of your tags in your
code. Use output buffering, run tidy to clean up the generated html,
and then output the lot.

Thanks for the reply, can you explain this a bit more, I don't quite
get
what you mean, or the functions your talking about.


http://www.php.net/manual/en/ref.outcontrol.php

Read also the user comments...

--
http://home.mysth.be/~timvw
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

27 posts views Thread by Fuli Chang | last post: by
8 posts views Thread by Seth | last post: by
258 posts views Thread by Terry Andersen | last post: by
1 post views Thread by coder10 | last post: by
4 posts views Thread by Arthur Dent | last post: by
5 posts views Thread by Surbhi | last post: by
3 posts views Thread by CJM | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.