I am a rookie with PHP, so here's my question.
I want to add a custom marker ICON on GoogleMap to each category.
Here what I want to do: icon:
"if php listing-type=6 ?>/images/red-marker.png"<br/>
"if php listing-type=7 ?>/images/blue-marker.png"
The code I have:
options: {
icon : "<?php echo get_template_directory_uri(); ?>/images/red-marker.png"
},
Here it´s the full code:
http://descubrime.com.ar/fullcode.txt
And here its the site:
I am completly lost!
I am not clear on what you are asking, but I am almost sure you want something like this. Please alert me if you were asking something else.
Since you are a beginner, I will try and explain myself.
Your basic question is to inject the path of your icon dynamically in your javascript. So anywhere before the
options
line, you start to declare the above php code and declare yourparentDirectory
and thelisting type
. I have used a methodgetListingType()
which can be anything to get the listing (6, 7 whatever). Then based on the type I prepare my$icon
variable which contains the dynamic path to your actual file.