This is because tidy is for optimizing HTML, not for optimizing PHP. > Daevid Vincent <daevid@xxxxxxxxxx> 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/<?= $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)"> > > 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.moniz@xxxxxxxxx] > Sent: Wednesday, April 17, 2013 2:55 PM > To: Daevid Vincent > Cc: php-general General > Subject: Re: 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 <daevid@xxxxxxxxxx> 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: marco@xxxxxxxxxx Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php