The simpler media website CMS
Hello ! Sorry to bother you peoples, with my PHP level 1 skills.
Thinking it was easy, but I already spend... hours trying to solve it ^^'
Here is the deal :
In picture view if I want to hide the bloc section of the OSM plugin, I wrote this :
if(function_exists('printOpenStreetMap') && (getImageData('EXIFGPSLatitude')!='')) {
echo '<section class="bloc-osm">';
echo '<h2>Maps</h2>';
@call_user_func('printOpenStreetMap');
echo '</section>';
}
And it's working
In Album view, I tried : if (!empty(printOpenStreetMap())) { ... }
if (!empty(getAlbumGeodata($_zp_current_album))) { ... }
if (!empty(getGeoData())) { ... }
if (!empty(getGeoDataJS())) { ... }
None of them are working. Any clue ?
Thanks !
Comments
This function "prints" and does not return anything. You cannot check if or empty therefore. Most "get" functions return values. In any case read the docs first before using something.
These all are class methods of the openStreetMap class and not standalone functions to use.
https://docs.zenphoto.org/1.5.x/class-openStreetMap.html
To do what you want to do you have to use the class object directly.
https://docs.zenphoto.org/1.5.x/source-class-openStreetMap.html#388-502
Off head this should work:
if you already use
if(function_exists('printOpenStreetMap')
as a check you don't need to@call_user_func('printOpenStreetMap');
which has the same reason. You need the wrapping check with my code as well. You could also useif(class_exists('openstreetmap')) {
or the generalif(extensionEnabled('openstreetmap')) {
instead.Hello acrylian, thanks for your support ! I'm gonna to try this.