SV: Javascript backslash in php dom object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I finally got it working:

<?php
$html = '
<html>
	<head>
		<style>'.file_get_contents("http://ol3js.org/en/master/css/ol.css";).'</style>
		<script type="text/javascript">'.htmlspecialchars(file_get_contents("http://ol3js.org/en/master/build/ol.js";)).'</script>
	</head>
	<body>
		<div id="map"></div>
    	<script type="text/javascript">
      		var map = new ol.Map({
        		target: "map",
        		renderer: "canvas",
        		layers: [
          			new ol.layer.Tile({
            			title: "Global Imagery",
            			source: new ol.source.TileWMS({
              				url: "http://maps.opengeo.org/geowebcache/service/wms";,
              				params: {LAYERS: "bluemarble", VERSION: "1.1.1"}
            			})
         			})
        		],
        		view: new ol.View2D({
          			projection: "EPSG:4326",
          			center: [0, 0],
          			zoom: 0,
          			maxResolution: 0.703125
        		})
      		});
    	</script>
	</body>
</html>';
$dom = new DOMDocument();
$dom->loadHTML($html);
$html2 = $dom->saveHTML();
echo htmlspecialchars_decode($html2);
?>

/H
________________________________________
Från: Frank Arensmeier [farensmeier@xxxxxxxxx]
Skickat: den 12 maj 2014 11:15
Till: Uggla Henrik
Kopia: php-general@xxxxxxxxxxxxx
Ämne: Re:  Javascript backslash in php dom object

12 maj 2014 kl. 11:11 skrev Uggla Henrik <Henrik.Uggla@xxxxxxxxxxxxxxx>:

> I don't want each client downloading the script from http://ol3js.org separately. The script should be loaded by the server, cached and delivered to the clients.

Make a copy of that script, save it on your server and include a URL pointing to your local copy instead? What’s the difference between providing a URL and including the source code? The payload is more or less the same.
/frank

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux