bwakad

error MarkupGoogleMap.module

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?

Share this post


Link to post
Share on other sites

That errors to me that you are not passing a page array as the first argument of the render() call. Show us your code!

Share this post


Link to post
Share on other sites

this is the code I started with:

$item = $pages->find("template=child-template, provincie=drenthe");
$map = $modules->get('MarkupGoogleMap');
echo $map->render($item, 'map');

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.