Jump to content

error MarkupGoogleMap.module


bwakad
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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.
 

  • Like 1
Link to comment
Share on other sites

  • 4 years later...
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
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...