-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get Lat/Lng individual? #1
Comments
Good idea. I'm not sure how I could make your suggestion work though. I currently split the string on a comma in my template. Originally I wanted to use two fields in Kirby, but I had some issues with that so I chose to use one field. |
True... thought about custom field methods, but that's not really an ideal way and would require to add another file to a different folder. Not worth it, I think. Maybe just include in your README For even more beginners convenience ;) |
I've found a 'workaround' for this.
<?php
field::$methods['lat'] = function($field) {
$parts = explode(',',$field->value);
return $parts[0];
};
field::$methods['lng'] = function($field) {
$parts = explode(',',$field->value);
return $parts[1];
}; Now in your template you should be able to do: I will see about including it in the plugin somehow. |
lol, we posted about the same fix on the same time I see 👍 |
Exactly - but as that file has to be in the plugins folder, I think it is better to not include it into your plugin. Would make the install more complicated for that lil help |
include a plugin and a field in the distro? |
@timgauthier The explanation above you should help to get you going. The 'field part' of the geolocation field is merely a string split, nothing too fancy. |
The map does not appear in my template. Using Kirby 2.1.0. I have followed all the steps and do not to make this worked. Only appear the two number (Lat & Lng) |
Hey @juangiga the plugin only stores the geolocation data. It's up to you to generate a map (using mapbox or google maps for example) and add the geolocation. You can look at the |
Hi @juangiga, please create a new issue if your problem still persists. |
Any way to get the latitude or longitude individually?
Would be a great way, if one could do $page->location()->lat()
The text was updated successfully, but these errors were encountered: