bwakad Posted April 14, 2014 Posted April 14, 2014 Error: Call to a member function first() on a non-object (line 175 of C:\xampp\htdocs\host\site\modules\FieldtypeMapMarker\MarkupGoogleMap.module) Installed MapMarker Fieldtype and Map Markup (google maps). Added this in my header: <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> The field is called map. It's added to my template. The current page has values entered for this field. this is in my template: $map = $modules->get('MarkupGoogleMap');echo $map->render($page, 'map'); Do I need to add something else besides the module?
adrian Posted April 14, 2014 Posted April 14, 2014 That errors to me that you are not passing a page array as the first argument of the render() call. Show us your code!
bwakad Posted April 15, 2014 Author Posted April 15, 2014 this is the code I started with: $item = $pages->find("template=child-template, provincie=drenthe");$map = $modules->get('MarkupGoogleMap');echo $map->render($item, 'map');
adrian Posted April 15, 2014 Posted April 15, 2014 Please have another read of the instructions: https://github.com/ryancramerdesign/FieldtypeMapMarker You need to either render the current page, or a page array, but in either case, you need to make sure you replace the second argument in the render to match the name of your map field. Have you checked the result of your $pages->find? In case you don't know about it already, take a look at Nik's excellent Selector Test module for testing the results of a selector. 1
cyberderf Posted February 8, 2019 Posted February 8, 2019 Quick question about this code insert instruction.. do I have to replace $page with something else? $map = $modules->get('MarkupGoogleMap'); echo $map->render($page, 'map'); ````````` In the above, $page is the Page object that has the 'map' field. Rreplace 'map' with the name of your FieldtypeMap field
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now