[ciapug] Dynamically formatted HTML Source

James Loghry loghry at krellinst.org
Thu Sep 7 16:50:36 CDT 2006


Carl, Thats what I have been doing as well, and I am trying to remedy
that  ;) .
Tidy actually has a plugin for PHP.  However, when I try to install tidy
on my webserver, it complains about not being able to find php-config
(even when I specify php-config as an argument..

Anyways I may have found an easier route along the lines of appending
the HTML to a DOM structure and then outputting the HTML:

$out = ob_get_contents();
$dom = new DomDocument();
$dom->loadHTML($out);
echo $dom->saveHTML();

I have yet to try this and see if it works, however.

Carl Olsen wrote:

> > Maybe I didn't understand the question.  When I'm using PHP to output some
> > HTML, it doesn't produce any line breaks or indentation in the HTML source
> > view.  I add them manually so that it looks like it was created with an HTML
> > editor.
> >
> > Carl
> > http://www.ciapug.net/
> >
> >
> >
> > -----Original Message-----
> > From: ciapug-bounces at cialug.org [mailto:ciapug-bounces at cialug.org] On Behalf
> > Of Tony Bibbs
> > Sent: Thursday, September 07, 2006 3:32 PM
> > To: loghry at krellinst.org; ciapug at cialug.org
> > Subject: Re: [ciapug] Dynamically formatted HTML Source
> >
> > Here you go:
> >
> > http://www.w3.org/People/Raggett/tidy/
> >
> > Search for indenting.
> >
> > --Tony
> >
> > James Loghry wrote:
> >   
>   
>> >> I'm constantly dealing with dynamic web sites using PHP here at work. 
>> >> It's a pain to keep track of all the newlines and tabs and whatnot when
>> >> displaying HTML through php.  This is especially true when there are
>> >> several included files.
>> >>
>> >> Is there a nice and easy trick to have PHP nicely format the HTML source
>> >> before the client browser sees it? Perhaps in XHTML format or such? 
>> >> (By format I mean the spacing and tabs of elements)
>> >>
>> >>     
>>     
> > _______________________________________________
> > ciapug mailing list
> > ciapug at cialug.org
> > http://cialug.org/mailman/listinfo/ciapug
> >   
>   


-- James Loghry Software Engineer The Krell Institute 1609 Golden Aspen
Dr., Suite 101 Ames, IA 50010 http://www.krellinst.org Phone: (515) 956
- 3696 Email: loghry at krellinst.org



More information about the ciapug mailing list