close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Using two different color pins?

Thread began 3/29/2010 11:02 pm by millerb395386 | Last modified 4/07/2010 1:22 pm by Eric Mittman | 2868 views | 9 replies |

millerb395386

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

Sign in to reply to this post

Eric Mittman

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:

php:
(($_rowYourRS['your binary column'] == 1)?color 1 file:color 2 file)
Sign in to reply to this post

Bryan Miller

Thanks Eric. That is exactly what I need to do.

Why didn't I think of that? ;-)

-Bryan

Sign in to reply to this post

Bryan Miller

Originally Said By: Eric Mittman
  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:

php:
(($_rowYourRS['your binary column'] == 1)?color 1 file:color 2 file)
  



What does the color file name look like normally?

Sign in to reply to this post

Eric Mittman

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.

Sign in to reply to this post

Bryan Miller

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:

php:
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

Sign in to reply to this post

Bryan Miller

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.

php:
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);
Sign in to reply to this post

Eric Mittman

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.

Sign in to reply to this post

Bryan Miller

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

Sign in to reply to this post

Eric Mittman

The implementation is very clean and easy to understand, no questions about which ranges are private and which ones are open to the public.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...