473,320 Members | 1,993 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 1972
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Fuli Chang | last post by:
I don't like other people see my html code. Is there a way to hide it? Thanks.
8
by: Seth | last post by:
How can I completely turn off the auto formatting of Html in Visual Studio 7? I have tried all possible combinations (at least I think I have) of the Tools / Options / Text Editor / HTML XML /...
258
by: Terry Andersen | last post by:
If I have: struct one_{ unsigned int one_1; unsigned short one_2; unsigned short one_3; }; struct two_{ unsigned int two_1;
1
by: coder10 | last post by:
Two things 1. Why does ASP.Net not respect code formatting for the HTML tags. I mean, when I write my HTML, I try to use appropriate tabs and spaces and lines beween my tags, but when I save and...
10
by: Coleen | last post by:
Hi all :-) I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML. Here is the snippet of code for the cell I'm trying to format: Dim...
4
by: Arthur Dent | last post by:
Hello all, ive been programming with ASP.NET since it came out, but am just getting my feet with now with v.2. Ive noticed something strange in the way my HTML tables get rendered with 2. I use...
3
by: realmerl | last post by:
Hi All. I'm trying to transform a html document into plain text via xslt. Simple you say! (i hope) I have got it working, by using the magnificent <xsl:value-of select="."/>. This returns the...
3
sanjay123456
by: sanjay123456 | last post by:
Dear friends, <?php //define the receiver of the email $to = 'sanjay.mit@gmail.com'; //define the subject of the email $subject = 'Test HTML email'; //create a boundary string. It must be...
5
by: Surbhi | last post by:
Hi We have HTML datasheets but now we want then in PDF format because page layout is very bad when HTML is printed. I am through with the XML and XSLT part. But donot hav any idea of XSL- FO....
3
by: CJM | last post by:
David, Thanks for the reply. Responses inline: "David E. Ross" <nobody@nowhere.notwrote in message news:OZadnaBdOMGpYb3VnZ2dnUVZ_vOdnZ2d@softcom.net... This is a promotional mailshot so...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.