M
M
maxsmart2014-07-28 17:39:48
PHP
maxsmart, 2014-07-28 17:39:48

How to add a description to the Yandex Maps balloon?

Hello! Tell me such a moment, you need to add a description to the Yandex Maps label balloon. Now, when you click on the label, the time from the MySQL table is displayed, I want the address to be in the description of the balkun. How to implement it?
Now the code looks like this:

var balloons = [<?php $myrow = mysql_query("SELECT cartime FROM data WHERE fio='$fio' AND carmodel='$carmodel' AND cardate='$cardate'"); while (($myrowresult = mysql_fetch_array($myrow))) { print_r ("'$myrowresult[0]', "); } ?>], i = 0;
    objects.then(function () {
        objects.get(0).balloon.open();
        for(var i = 0, len = objects.getLength(); i < len; i++) {
             objects.get(i).properties.set('iconContent', i + 1, 'results', '1');
             objects.get(i).properties.set('balloonContentBody', balloons[i]);
             
        }
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxsmart, 2014-07-28
@maxsmart

Figured it out myself)

var balloons = [<?php $myrow = mysql_query("SELECT cartime FROM data WHERE fio='$fio' AND carmodel='$carmodel' AND cardate='$cardate'"); while (($myrowresult = mysql_fetch_array($myrow))) { print_r ("'$myrowresult[0]', "); } ?>], i = 0;
    var balloonsfooter = [<?php $myrow2 = mysql_query("SELECT address FROM data WHERE fio='$fio' AND carmodel='$carmodel' AND cardate='$cardate'"); while (($myrowresult2 = mysql_fetch_array($myrow2))) { print_r ("'$myrowresult2[0]', "); } ?>], i = 0;
    objects.then(function () {
        objects.get(0).balloon.open();
        for(var i = 0, len = objects.getLength(); i < len; i++) {
             objects.get(i).properties.set('iconContent', i + 1, 'results', '1');
             objects.get(i).properties.set('balloonContentBody', balloons[i]);
             objects.get(i).properties.set('balloonContentFooter', balloonsfooter[i]);
             
        }
    });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question