Jump to content
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...