-1

I am trying to get variable from another variable to get geocoding of maps, but i stuck with this error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\wordpress\wp-content\plugins\WP-Shortcode-Boilerplate-master\shortcode\shortcode-member.php on line 32

this is my code: function aa_member_shortcode( $atts) {

        return "<div id='map'></div>
            <script>
              function initMap() {
                var latt= parseInt($atts['lat']);
                var lngg= parseInt($atts['lng']);

                var uluru = {lat: latt, lng: lngg};
                var map = new google.maps.Map(document.getElementById('map'), {
                  zoom: 4,
                  center: uluru
                });
                var marker = new google.maps.Marker({
                  position: uluru,
                  map: map
                });
              }
            </script>
            <script async defer
            src='https://maps.googleapis.com/maps/api/js?key=AIzaSyDvHNBbBdWA49bIsUMLwj3RpoZFQWSRJJ0&callback=initMap'>
            </script>";

}

1 Answers1

0

This is a PHP error. Write {$atts['lat']} instead of $atts['lat'].

sigalor
  • 901
  • 11
  • 24
  • another question if you please: the map won't display to me...do you have any idea wy, she work well wen i enter a true value instead a variabls, like this: – piair jako Oct 20 '17 at 14:57
  • If my answer is the solution to your original problem, please click the checkmark on the left hand side to accept it :) Regarding your other problem: I don't know what kind of data your PHP map actually keeps. A first step would be to inspect the page's source code when it's shown in the browser. Then you can see what PHP outputs instead of the wanted number. – sigalor Oct 22 '17 at 18:50