SV: [PHP] Javascript backslash in php dom object
| From: | Uggla Henrik | Date: | Mon, 12 May 2014 09:44:32 +0000 |
| Subject: | SV: [PHP] Javascript backslash in php dom object | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323287@lists.php.net to get a copy of this message | ||
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@gmail.com]
Skickat: den 12 maj 2014 11:15
Till: Uggla Henrik
Kopia: php-general@lists.php.net
Ämne: Re: [PHP] Javascript backslash in php dom object
12 maj 2014 kl. 11:11 skrev Uggla Henrik <Henrik.Uggla@kristianstad.se>:
> I don't want each client downloading the script from :I‡#XI«Ú
> Löù5pXhttp://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