php-general Digest 3 May 2013 11:28:12 -0000 Issue 8216

Topics (messages 321001 through 321001):

Re: Need a tool to minimize HTML before storing in memecache
        321001 by: marco.behnke.biz

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
But why are you caching uncompiled php code?

> Daevid Vincent <dae...@daevid.com> hat am 2. Mai 2013 um 23:21 geschrieben:
>
>
> While that may be true for most users, I see no reason that it should limit or
> force me to a certain use case given that dynamic pages make up the vast
> majority of web pages served.
>
> Secondly, there are 8 billion options in Tidy to configure it, I would be
> astonished if they were so short-sighted to not have one to disable converting
> < and > to &lt; and &gt; as they do for all sorts of other things like quotes,
> ampersands, etc. I just don't know which flag this falls under or what
> combination of flags I'm setting that is causing this to happen.
>
> Barring that little snag, it works like a champ.
>
> > -----Original Message-----
> > From: ma...@behnke.biz [mailto:ma...@behnke.biz]
> > Sent: Thursday, May 02, 2013 4:55 AM
> > To: Daevid Vincent; 'php-general General'
> > Subject: RE: [PHP] Need a tool to minimize HTML before storing in memecache
> >
> > This is because tidy is for optimizing HTML, not for optimizing PHP.
> >
> > > Daevid Vincent <dae...@daevid.com> hat am 2. Mai 2013 um 02:20
> > geschrieben:
> > >
> > >
> > > So I took the time to install Tidy extension and wedge it into my code.
> > Now
> > > there is one thing that is killing me and breaking all my pages.
> > >
> > > This is what I WANT the result to be:
> > >
> > >                 <link rel="stylesheet" type="text/css"
> > href="/templates/<?=
> > > $layout_id ?>/css/styles.css" />
> > >                 <link rel="stylesheet" type="text/css"
> > href="/templates/<?=
> > > $layout_id ?>/css/retina.css" media="only screen and
> > > (-webkit-min-device-pixel-ratio: 2)" />
> > >
> > > Which then 'renders' out to this normally without Tidy:
> > >
> > >                 <link rel="stylesheet" type="text/css"
> > > href="/templates/2/css/styles.css" />
> > >                 <link rel="stylesheet" type="text/css"
> > > href="/templates/2/css/retina.css" media="only screen and
> > > (-webkit-min-device-pixel-ratio: 2)" />
> > >
> > > This is what Tidy does:
> > >
> > >                 <link rel="stylesheet" type="text/css"
> > > href="/templates/%3C?=%20$layout_id%20?%3E/css/styles.css">
> > >                 <link rel="stylesheet" type="text/css"
> > > href="/templates/%3C?=%20$layout_id%20?%3E/css/retina.css" media="only
> > > screen and (-webkit-min-device-pixel-ratio: 2)">
> > >
> > > I found ['fix-uri' => false] which gets closer:
> > >
> > >                 <link rel="stylesheet" type="text/css"
> > > href="/templates/&lt;?= $layout_id ?&gt;/css/styles.css">
> > >                 <link rel="stylesheet" type="text/css"
> > > href="/templates/&lt;?= $layout_id ?&gt;/css/retina.css" media="only
> > screen
> > > and (-webkit-min-device-pixel-ratio: 2)">
> > >
> > > I've tried about every option I can think of. What is the solution to make
> > > it stop trying to be smarter than me and converting my < and > tags??
> > >
> > > //See all parameters available here:
> > > http://tidy.sourceforge.net/docs/quickref.html
> > > $tconfig = array(
> > >        //'clean' => true,
> > >        'hide-comments' => true,
> > >        'hide-endtags' => true,
> > >        'drop-proprietary-attributes' => true,
> > >        //'join-classes' => true,
> > >        //'join-styles' => true,
> > >        //'quote-marks' => true,
> > >        'fix-uri' => false,
> > >        'numeric-entities' => true,
> > >        'preserve-entities' => true,
> > >        'doctype' => 'omit',
> > >        'tab-size' => 1,
> > >        'wrap' => 0,
> > >        'wrap-php' => false,
> > >        'char-encoding' => 'raw',
> > >        'input-encoding' => 'raw',
> > >        'output-encoding' => 'raw',
> > >        'newline' => 'LF',
> > >        'tidy-mark' => false,
> > >        'quiet' => true,
> > >        'show-errors' => ($this->_debug ? 6 : 0),
> > >        'show-warnings' => $this->_debug,
> > > );
> > >
> > >
> > > From: Joseph Moniz [mailto:joseph.mo...@gmail.com]
> > > Sent: Wednesday, April 17, 2013 2:55 PM
> > > To: Daevid Vincent
> > > Cc: php-general General
> > > Subject: Re: [PHP] Need a tool to minimize HTML before storing in
> > memecache
> > >
> > > http://php.net/manual/en/book.tidy.php
> > >
> > >
> > > - Joseph Moniz
> > > (510) 509-0775 | @josephmoniz <https://twitter.com/josephmoniz>  |
> > > <https://github.com/JosephMoniz> GitHub |
> > > <http://www.linkedin.com/pub/joseph-moniz/13/949/b54/> LinkedIn | Blog
> > > <http://josephmoniz.github.io/>  | CoderWall
> > > <https://coderwall.com/josephmoniz>
> > >
> > > "Wake up early, Stay up late, Change the world"
> > >
> > > On Wed, Apr 17, 2013 at 2:52 PM, Daevid Vincent <dae...@daevid.com> wrote:
> > > We do a lot with caching and storing in memecached as well as local copies
> > > so as to not hit the cache pool over the network and we have found some
> > > great tools to minimize our javascript and our css, and now we'd like to
> > > compress our HTML in these cache slabs.
> > >
> > >
> > >
> > > Anyone know of a good tool or even regex magic that I can call from PHP to
> > > compress/minimize the giant string web page before I store it in the
> > cache?
> > >
> > >
> > >
> > > It's not quite as simple as stripping white space b/c obviously there are
> > > spaces between attributes in tags that need to be preserved, but also in
> > the
> > > words/text on the page. I could strip out newlines I suppose, but then do
> > I
> > > run into any issues in other ways? In any event, it seems like someone
> > would
> > > have solved this by now before I go re-inventing the wheel.
> > >
> > >
> > >
> > > d.
> > >
> >
> > --
> > Marco Behnke
> > Dipl. Informatiker (FH), SAE Audio Engineer Diploma
> > Zend Certified Engineer PHP 5.3
> >
> > Tel.: 0174 / 9722336
> > e-Mail: ma...@behnke.biz
> >
> > Softwaretechnik Behnke
> > Heinrich-Heine-Str. 7D
> > 21218 Seevetal
> >
> > http://www.behnke.biz
>

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

--- End Message ---

Reply via email to