Forums / Setup & design / Code Cut Off

Code Cut Off

Author Message

Rick -

Tuesday 18 July 2006 5:01:32 am

Hey,

I'm trying to implement google maps into our site, but ezPublish is cutting off the code that I'm pulling from an include.

It gets this far:

    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=zxa"
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load()

But gets cut off here, and should continue with:

 {
      if (GBrowserIsCompatible()) {

      function createMarker(point,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }
	  
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(-28.134414, 153.490248), 16);
		map.addControl(new GSmallZoomControl());
		map.addControl(new GMapTypeControl());
		
		var point = new GLatLng(-28.134414, 153.490248);
      var marker = createMarker(point,'Waves')
      map.addOverlay(marker);
      }
    }
    //]]>
    </script>

Any idea why its getting cut off?

Cheers,

Rick.

Kristof Coomans

Tuesday 18 July 2006 5:07:07 am

Hello Rick

You have to replace { and } with {ldelim} ( http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/miscellaneous/ldelim ) and {rdelim} ( http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/miscellaneous/rdelim ) in embedded JavaScript code in an eZ publish template, or put the JavaScript code in a literal block ( http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_functions/miscellaneous/literal ).

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Łukasz Serwatka

Tuesday 18 July 2006 5:07:48 am

This is common issue with curly brackets. Warp your whole JavaScript code between {literal} tags.

{literal}
<script type="text/javascript"> 
   //<![CDATA[ 
   function load() 
 { 
     if (GBrowserIsCompatible()) { 
 
     function createMarker(point,html) { 
       var marker = new GMarker(point); 
       GEvent.addListener(marker, "click", function() { 
         marker.openInfoWindowHtml(html); 
       }); 
       return marker; 
     } 
          
       var map = new GMap2(document.getElementById("map")); 
       map.setCenter(new GLatLng(-28.134414, 153.490248), 16); 
                map.addControl(new GSmallZoomControl()); 
                map.addControl(new GMapTypeControl()); 
                 
                var point = new GLatLng(-28.134414, 153.490248); 
     var marker = createMarker(point,'Waves') 
     map.addOverlay(marker); 
     } 
   } 
   //]]> 
   </script>
{/literal}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Łukasz Serwatka

Tuesday 18 July 2006 5:08:54 am

ah, 41 seconds to late ;)

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Rick -

Tuesday 18 July 2006 6:10:56 am

Great guys, that did the trick - thanks!

Rick -

Tuesday 18 July 2006 6:15:51 am

Actually, one other quick question.

Do you know why why I call a value from a node, using this:

{attribute_view_gui attribute=$node.object.data_map.sometxtfield}

When it outputs the code, it drops it down on the next line, even though I didn't place it on one. This behavior is site wide - can't seem to find out why it does this.

Thanks!

Rick.