473,387 Members | 1,721 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,387 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 1976
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.