Tell us what you are trying to do?
Include the map in a PDF Generated page with the correct market position.
Is there any documentation that you are following?
hidden link
https://toolset.com/documentation/customizing-sites-using-php/functions/
https://toolset.com/forums/topic/i-am-not-able-to-display-an-address-field-as-a-map-on-a-template/
Is there a similar example that we can see? no
This is the code to display the map in the View:
[wpv-conditional if="( $(wpcf-morada-para-google-maps) ne '' )"][wpv-map-render map_id="map-2" fitbounds="off" single_center="on"][/wpv-map-render]
[wpv-map-marker map_id='map-2' marker_id='marker-2' marker_field='wpcf-morada-para-google-maps'][/wpv-map-marker][/wpv-conditional]
I'm using DKPDF Plugin which uses the mpdf source code to generate PDF. I have the PDF button on the listing page.
It uses PHP Template. I was able to insert several Toolset Fields in it and working fine, but now i want to display the Google Map styled exactly the same as viewed on the page.
<img src="hidden link;?php types_render_field("morada-para-google-maps", array())?>&zoom=12&size=800x200&maptype=roadmap&markers=color:red%7C&key=MY_API_KEY" />
This displays the map but in the middle of the ocean...
<?php types_render_field("morada-para-google-maps", array())?>
If i use this outside the img src, it displays nothing.
If i go to the URL in the browser replacing the php render field for the address, it displays fine, althought it doesn't display with Silver Skin which is intended.
Do you happen to know why i can't get to show the address in the PDF while other fields i can?
For example:
This is working perfectly fine.
<div class="header-item subtitulo-single"><?php echo types_render_field( "sub-titulo1", array( ) )?></div>
thanks
My issue is resolved now. Thank you!
I was missing the "echo"...
Actually... the map now shows up fine, and even with silver skin.
But the marker does not show.
According to Google, for the marker to show:
hidden link
&markers=color:blue%7Clabel:S%7C40.702147,-74.015794
&key=YOUR_API_KEY
How can i retrieve the coordinates from the address field so that i can add it to the URL?
This is my code at the moment:
<img src="hidden link;?php echo types_render_field("morada-para-google-maps", array())?>&zoom=12&format=png&maptype=roadmap&style=element:geometry%7Ccolor:0xf5f5f5&style=element:labels.icon%7Cvisibility:off&style=element:labels.text.fill%7Ccolor:0x616161&style=element:labels.text.stroke%7Ccolor:0xf5f5f5&style=feature:administrative.land_parcel%7Celement:labels.text.fill%7Ccolor:0xbdbdbd&style=feature:poi%7Celement:geometry%7Ccolor:0xeeeeee&style=feature:poi%7Celement:labels.text.fill%7Ccolor:0x757575&style=feature:poi.park%7Celement:geometry%7Ccolor:0xe5e5e5&style=feature:poi.park%7Celement:labels.text.fill%7Ccolor:0x9e9e9e&style=feature:road%7Celement:geometry%7Ccolor:0xffffff&style=feature:road.arterial%7Celement:labels.text.fill%7Ccolor:0x757575&style=feature:road.highway%7Celement:geometry%7Ccolor:0xdadada&style=feature:road.highway%7Celement:labels.text.fill%7Ccolor:0x616161&style=feature:road.local%7Celement:labels.text.fill%7Ccolor:0x9e9e9e&style=feature:transit.line%7Celement:geometry%7Ccolor:0xe5e5e5&style=feature:transit.station%7Celement:geometry%7Ccolor:0xeeeeee&style=feature:water%7Celement:geometry%7Ccolor:0xc9c9c9&style=feature:water%7Celement:labels.text.fill%7Ccolor:0x9e9e9e&size=1000x250"
Hello,
You can get the retrieve the coordinates from the address field by using parameter "format", for example:
echo types_render_field( "sub-titulo1", array( "format" => 'FIELD_LATITUDE');
echo types_render_field( "sub-titulo1", array( "format" => 'FIELD_LONGITUDE');
More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#address
format:
Use the literals FIELD_ADDRESS, FIELD_LATITUDE and FIELD_LONGITUDE in the format to output the address