Foren
How to use HTML tags in liferay
pawan chauhan, geändert vor 11 Jahren.
How to use HTML tags in liferay
Junior Member Beiträge: 75 Beitrittsdatum: 08.10.12 Neueste Beiträge
Hi all,
I have been trying to use google maps api in my liferay application.
using the following code snippet i can do so but the problem is that i cant change this code to format that can be put in "view.jsp" of liferay.
please help me.
code snippet:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxxxxxxxxxxxxxxxx&sensor=true">
</script>
<script type="text/javascript">
function initialize()
{
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
I have been trying to use google maps api in my liferay application.
using the following code snippet i can do so but the problem is that i cant change this code to format that can be put in "view.jsp" of liferay.
please help me.
code snippet:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxxxxxxxxxxxxxxxx&sensor=true">
</script>
<script type="text/javascript">
function initialize()
{
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
James Falkner, geändert vor 11 Jahren.
RE: How to use HTML tags in liferay
Liferay Legend Beiträge: 1399 Beitrittsdatum: 17.09.10 Neueste Beiträgepawan chauhan:
Hi all,
I have been trying to use google maps api in my liferay application.
using the following code snippet i can do so but the problem is that i cant change this code to format that can be put in "view.jsp" of liferay.
please help me.
Is that your own Google API key? You might not want to post that in the forum, but even better you might want to upgrade to the Google Maps API Version 3 which no longer requires an API key.
What errors do you get?
pawan chauhan, geändert vor 11 Jahren.
RE: How to use HTML tags in liferay
Junior Member Beiträge: 75 Beitrittsdatum: 08.10.12 Neueste Beiträge
Hi james,
When i put that code snippet in view.jsp, nothing gets displayed on the portal.
When i put that code snippet in view.jsp, nothing gets displayed on the portal.
James Falkner, geändert vor 11 Jahren.
RE: How to use HTML tags in liferay
Liferay Legend Beiträge: 1399 Beitrittsdatum: 17.09.10 Neueste Beiträgepawan chauhan:
Hi james,
When i put that code snippet in view.jsp, nothing gets displayed on the portal.
Try this for view.jsp:
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineobjects />
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script type="text/javascript">
var map;
function initialize() {
console.log("init");
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="map_canvas" style="width:500px; height:500px"></div>
Milan Palian, geändert vor 10 Jahren.
RE: How to use HTML tags in liferay
Junior Member Beiträge: 43 Beitrittsdatum: 10.12.09 Neueste Beiträge
James,
It is really nice to have an example like this that works immediately using copy-paste, instead of having to fill in the gaps.
Thanks,
Milan
It is really nice to have an example like this that works immediately using copy-paste, instead of having to fill in the gaps.
Thanks,
Milan