I have a macro set up to display a Google Map, and I use the macro to allow users to enter up to 25 markers for the map, plus a label and info field for each. This has been working fine, as most instances of the map just contain a few markers.
However, I now have the situation where a user needs to use all 25 markers - they enter the details correctly and save and publish the page and all is well.
But when they go back to edit the content of the page (editing the macro in the Rich Text editor) they get a 404 error.
It seems that this may be caused by the "insert macro" button being limited to a maximum amount of characters in the macro paarmeters.
Does anyone know if this is correct and, if so, how to extend the number of characters allowed?
I'm not aware that there should be a limit on how many parameters you add to a macro - but perhaps there is a bug with it on the version you're using?
A bit off topic...is there any specific reason why you set the markers as parameters directly on the macro instead of using a document type to represent a marker,s o it can be grouped in a folder in a repository in the content section perhaps? That way it will be easier to maintain and there are no limits on how many markers could be added...Don't know if you have thought about it or if it makes sense in your context...but I can just imagine how cumbersome it is to change parameters on the macro if the customer all of the sudden want to have another sort order on them..:-)
Re the second question, there's no specific reason other than, as a relative novice on Umbraco, that was the only way I could see to do it! Any further guidance on the steps to do this would be gratefully received as you are right, it is cumbersome!
I can set up document types ok, but would then need to call them somehow into my Map macro?
OK - so I created a document type for the Map Markers, with 3 properties: marker, label and info.
I have also created a macro with 4 parameters - centre, mapwidth, mapheight, zoom.
Now I need to create the xslt.
Here's what I have so far, though it has errors and doesn't work! I need this to cycle through and pick up the marker details for all markers set up (if any), and display them on the map. I guess I need to set up the variables etc somehow for each marker and label them 1, 2 etc.
Not really sure how to do this, so any help gratefully received:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&region=GB"> </script> <script type="text/javascript"> function initialize() { var latlng = new google.maps.LatLng(<xsl:value-of select="$centre"/>); var myOptions = { zoom: <xsl:value-of select="$zoom"/>, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
<xsl:if test="count($currentPage/MapMarker)>0"> <xsl:for-each select="$currentPage/MapMarker"> var myLatlng1 = new google.maps.LatLng(<xsl:value-of select="$marker"/>);
It's probably because of the mix with XSLT and JavaScript - please post the whole XSLT code from the file in here, so it's easier to get an overview and guide you on how to do this - you need to make som non-pretty workarounds when using XSLT and JavaScript in a combination like this.
Macro error
I have a macro set up to display a Google Map, and I use the macro to allow users to enter up to 25 markers for the map, plus a label and info field for each. This has been working fine, as most instances of the map just contain a few markers.
However, I now have the situation where a user needs to use all 25 markers - they enter the details correctly and save and publish the page and all is well.
But when they go back to edit the content of the page (editing the macro in the Rich Text editor) they get a 404 error.
It seems that this may be caused by the "insert macro" button being limited to a maximum amount of characters in the macro paarmeters.
Does anyone know if this is correct and, if so, how to extend the number of characters allowed?
Hi Allan
What version of Umbraco are you using?
I'm not aware that there should be a limit on how many parameters you add to a macro - but perhaps there is a bug with it on the version you're using?
A bit off topic...is there any specific reason why you set the markers as parameters directly on the macro instead of using a document type to represent a marker,s o it can be grouped in a folder in a repository in the content section perhaps? That way it will be easier to maintain and there are no limits on how many markers could be added...Don't know if you have thought about it or if it makes sense in your context...but I can just imagine how cumbersome it is to change parameters on the macro if the customer all of the sudden want to have another sort order on them..:-)
/Jan
Hi Jan
Thanks for your reply.
To answer your first question, it's v 4.5.2.
Re the second question, there's no specific reason other than, as a relative novice on Umbraco, that was the only way I could see to do it! Any further guidance on the steps to do this would be gratefully received as you are right, it is cumbersome!
I can set up document types ok, but would then need to call them somehow into my Map macro?
Thanks
Allan
OK - so I created a document type for the Map Markers, with 3 properties: marker, label and info.
I have also created a macro with 4 parameters - centre, mapwidth, mapheight, zoom.
Now I need to create the xslt.
Here's what I have so far, though it has errors and doesn't work! I need this to cycle through and pick up the marker details for all markers set up (if any), and display them on the map. I guess I need to set up the variables etc somehow for each marker and label them 1, 2 etc.
Not really sure how to do this, so any help gratefully received:
Hi Allan
What kind of errors do you receive? I suppose that you need each marker to have a unique name, right?
In the case you could use position() to make sure each marker has a unique name...like this
var marker<xsl:value-of select="position()" />
and then you can reference it with marker<xsl:value-of select="position()" /> where needed I guess.
Does this work?
/Jan
Hi Jan
Thanks for your suggestions here.
Here's the error I'm getting with the code I posted previously - maybe I'm calling the value of the marker incorrectly from the MapMarker document?
Re your suggestion of using position(), how will this work inside " " ?
E.g. in the code below, I think the second part of the line is probably wrong?
Thanks
Allan
Hi Allan
It's probably because of the mix with XSLT and JavaScript - please post the whole XSLT code from the file in here, so it's easier to get an overview and guide you on how to do this - you need to make som non-pretty workarounds when using XSLT and JavaScript in a combination like this.
/Jan
Hi Jan
I posted the whole of the XSLT yesterday (except the standard top few lines) - does that answer your question, or are you looking for something else?
Thanks again
Allan
Hi Jan
Just wondered if you'd had a chance to take a look at this? I'm still looking to get this resolved...
Many thanks
Allan
is working on a reply...