E
E
EleGant232014-11-19 17:54:15
JavaScript
EleGant23, 2014-11-19 17:54:15

How to display labels from the database on YandexMap under PhoneGap?

DD, there is such a problem...
You need to display tags on the map... they are stored in a database on the server....
Yandex allows you to display tags in Javascript

ymaps.ready(function () {
    var myMap = new ymaps.Map('map', {
            center: [position.coords.latitude, position.coords.longitude ],
            zoom: 15,         
            controls: ['zoomControl']
        }),
        myPlacemark = new ymaps.Placemark(myMap.getCenter(), {
            hintContent: 'Собственный значок метки'
        }, {
            iconLayout: 'default#image',
            iconImageHref: 'http://vk.mirada.kz/ava/1a.png',
            iconImageSize: [45, 57]
        });

    myMap.geoObjects.add(myPlacemark)
/////вот ниже метка//////
     .add(new ymaps.Placemark([52.281754, 76.981974], {
            balloonContent: 'цвет <strong>воды пляжа бонди</strong>'
        }, {
             iconLayout: 'default#image',
            iconImageHref: '2.png',
            iconImageSize: [45, 57]
        }));
});

This code is in the client's application...
We need to make some kind of parser into this script to suck out the data....
The output itself from the database has already been done in *.php file on the server....
It outputs
.add(new ymaps.Placemark([52.275171, 76.962104], {
            balloonContent: 'цвет <strong>воды пляжа бонди</strong>'
        }, {
             iconLayout: 'default#image',
            iconImageHref: '3.png',
            iconImageSize: [45, 57]
        }))

such an info list .... tell me !!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Uspensky, 2014-11-19
@Kwisatz

There are three options:
1. just add your php script to:
myMap.geoObjects.add(myPlacemark);
and connect this case with a script
2. Throw out the scripts from the php output and leave json, load with ajax and perform the addition based on ajax data
3. Include the script directly in the file, which draws the map itself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question