HTML Formatting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hayden Kirk

    #1

    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('<bo dy>
    <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


  • Pedro Graca

    #2
    Re: HTML Formatting

    Hayden Kirk wrote:[color=blue]
    > 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('<bo dy>
    > <something');[/color]

    Outputs
    ========
    <body>
    <something
    ========
    [color=blue]
    > 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?[/color]

    Either do some reformatting inside outputhtml() (like stripping extra
    spaces, extra lines, ...) or pass it a 'nicer' string:

    outputhtml('<ht ml>
    <something');
    [color=blue]
    > I hope you get what I mean.[/color]

    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 =--

    Comment

    • Tim Van Wassenhove

      #3
      Re: HTML Formatting

      On 2004-02-27, Hayden Kirk <spam@spam.co m> wrote:[color=blue]
      > 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('<bo dy>
      > <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?
      >[/color]

      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.


      --

      Comment

      • Hayden Kirk

        #4
        Re: HTML Formatting

        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" <euki@pi.be> wrote in message
        news:c1mb41$1jk l6c$1@ID-188825.news.uni-berlin.de...[color=blue]
        > On 2004-02-27, Hayden Kirk <spam@spam.co m> wrote:[color=green]
        > > Hey
        > >
        > > I have a class called page. This class outputs a page in html. Now I[/color][/color]
        have a[color=blue][color=green]
        > > function called OutPutHtml
        > >
        > > This outputs html, however I want to be able to do this:
        > >
        > > outputhtml('<bo dy>
        > > <something');
        > >
        > > So I can keep it nice and formatted. But when I do this there are huge[/color][/color]
        gaps[color=blue][color=green]
        > > in the html. How can I do this so it formats it?
        > >[/color]
        >
        > 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[/color]


        Comment

        • Rudolf Horbas

          #5
          Re: HTML Formatting

          Hayden Kirk wrote:
          [color=blue]
          > "Tim Van Wassenhove" <euki@pi.be> wrote in message
          > news:c1mb41$1jk l6c$1@ID-188825.news.uni-berlin.de...
          > (...)[color=green]
          >>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.[/color]
          > (...)
          > 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.[/color]

          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

          Comment

          • Tim Van Wassenhove

            #6
            Re: HTML Formatting

            On 2004-02-27, Hayden Kirk <spam@spam.co m> wrote:[color=blue]
            > "Tim Van Wassenhove" <euki@pi.be> wrote in message
            > news:c1mb41$1jk l6c$1@ID-188825.news.uni-berlin.de...[color=green]
            >> On 2004-02-27, Hayden Kirk <spam@spam.co m> wrote:[color=darkred]
            >> > Hey
            >> >
            >> > I have a class called page. This class outputs a page in html. Now I[/color][/color]
            > have a[color=green][color=darkred]
            >> > function called OutPutHtml
            >> >
            >> > This outputs html, however I want to be able to do this:
            >> >
            >> > outputhtml('<bo dy>
            >> > <something');
            >> >
            >> > So I can keep it nice and formatted. But when I do this there are huge[/color][/color]
            > gaps[color=green][color=darkred]
            >> > in the html. How can I do this so it formats it?
            >> >[/color]
            >>
            >> 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.[/color][/color]
            [color=blue]
            > 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.[/color]



            Read also the user comments...

            --

            Comment

            Working...