fanchrobin

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: customizing POI when map generated by custom fields #13877
    fanchrobin
    Participant

    Hi Chris, Thank you for your answer. I am using v2.40.7 PRO. I have just sent you an email.
    Regards,

    fanchrobin
    Participant

    Hi, yes a map is generated for each post. It is generated from custom fields, not for each post in the Back-office, but in the template called when posts are displayed.
    eg. I have a template for posts called content.php
    In the WordPress Back-office : To add a new post, you have to fill a form. Each field of the form is a custom field.
    For the address, you have 3 custom fields : street address, postal code, city.
    In the Front-end : When a post is displayed, it calls content.php
    in content.php, there are some lines of code which generates the map from the custom field values. In order to correctly display the map, I’ve had to concatenate the 3 custom fields relating to the address.

    I tried to generate the maps with the Geocoding settings, but it’s not working for me: I guess it’s because of the address-related custom fields. I tried with the custom field ‘street address’ in address line 1, ‘postal code’ in address line 2, and ‘city’ in address line 3.

    Nonetheless the geocoding does not work, but with this method I also cannot control the exact place where the map displays in the post. The ‘before content’ or ‘after content’ options don’t fit with the other parts of the post’s content.

    fanchrobin
    Participant

    Hi Chris, thank you very much, now it works perfectly. Last question : You understood I generate maps dynamically for each post using my content template. Now I’d like to do a mashup of these, possible ?

    fanchrobin
    Participant

    Another odd thing :
    If the “BiggerMap” link is not selected in the settings and thus is not displayed in the front-end, the map doesn’t show. If the link is here, I have to click on it to show the map.

    fanchrobin
    Participant

    ( sorry, I missed that on the above post) the url is : http://semiocode.com/tsbv2/nos-maisons/manoir-de-la-boulaie/)
    Just made some tests, and get closer to the solution.
    You were right, latitude and longitude were missing.
    I tried with a POI containing the point parameter and it works. But the problem still remains to output latitude and longitude from the geocode() function. I need to dynamically generate latitude and longitude from address.

    This code works:

    $mymap = new Mappress_Map(array("width" => 646));
    $mypoi_1 = new Mappress_Poi(array("address" => $adresse_complete_resto_br, "point" => array("lat" => 47.1913630, "lng" => -1.4291270) )); // the address parameter is not necessary
    $mymap->pois = array($mypoi_1); 
    echo $mymap->display();

    This code doesn’t work:

    $mymap = new Mappress_Map(array("width" => 646));
    $mypoi_1 = new Mappress_Poi(array("address" => $adresse_complete_resto_br ));
    $mypoi_1->geocode(); // Apparently not working
    $mymap->pois = array($mypoi_1); 
    echo $mymap->display();
    fanchrobin
    Participant

    Hello Chris,
    Thank you for your quick answer.
    I tried the function geocode() in my template like this :

    $mymap = new Mappress_Map(array("width" => 646));
    $mypoi_1 = new Mappress_Poi(array("address" => $adresse_complete_resto_br ));
    $mypoi_1 = geocode();
    $mymap->pois = array($mypoi_1); 
    echo $mymap->display();

    and I get a PHP error ‘call to undefined function’.
    Here is the URL: See at the bottom of the post, under the title ‘MapPress Test’
    Thanks

Viewing 6 posts - 1 through 6 (of 6 total)