Using two different color pins?
Hello all,
I have a binary value in my recordset and I'd like to use Red pins for 0 and Blue pins for 1. Is this possible?
Thanks!
-Bryan
Hello all,
I have a binary value in my recordset and I'd like to use Red pins for 0 and Blue pins for 1. Is this possible?
Thanks!
-Bryan
This would require you to customize the js code in the php file that is included for the map. In here you should be able to see where the markers are being set, the color of the marker should be in the name of it.
You could add in a ternary type expression to make it choose one colors file over the other like this:
(($_rowYourRS['your binary column'] == 1)?color 1 file:color 2 file)
Thanks Eric. That is exactly what I need to do.
Why didn't I think of that? ;-)
-Bryan
(($_rowYourRS['your binary column'] == 1)?color 1 file:color 2 file)
What does the color file name look like normally?
Here is an example from the wagmp_map_1.php page for the icons:
icon_0.image = 'google_javascript/images/traditionalflat_pacifica.png';
It is these lines of code that you would edit to use the alternate color's file.
It seems to me it might be best to create icon_0 and icon_1 and then perform the substitution where it is referenced as we iterate over the recordset. I.e:
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon_0);
.
.
.
wagmp_map_1_obj.icons.push(icon_0);
I am thinking that using a different icon will require different shadow attributes, etc hence the need for a full second icon definition.
Or, am I over-complicating things?
-Bryan
OK. I got it working. I created two icon definitions:
icon_0 & icon_1
Then depending upon a value in the recordset I set my "icon" value to one or the other.
icon = <?php echo $foo=(($row_Google_recordset['private'] == 1) ? icon_0 : icon_1) ?>;
var marker_0_<?php echo $Google_recordset_id; ?> = new GMarker(point, icon);
.
.
.
wagmp_map_1_obj.icons.push(icon);
Very clever! I like the way you did this, I will bookmark this one for anyone else that is looking for a solution like this, good work.
Thanks Eric. I simply took your idea and ran with it.
If anyone wants to see it in action here is the URL
view_ranges.php
The implementation is very clean and easy to understand, no questions about which ranges are private and which ones are open to the public.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.