sebibu Posted 3 hours ago Share Posted 3 hours ago I really love LATTE (Template Engine by Nette) but here and there I still have problems with the syntax. I'm using RockPageBuilder by @bernhard and try to output the html for this module: https://processwire.com/modules/fieldtype-leaflet-map-marker/ In PHP this would be: <?php echo $map->render($page, 'YOUR MARKER FIELD'); ?> And in LATTE? 😆 I tried this variants and more: {$map->render($page, 'map')} {$map->render($page, 'block->map')} {$map->render($page, $block->map)} Getting: Call to a member function render() on null in block #1158 (rockpagebuilderblock-map) Maybe this topic can be a collection point for smaller Latte syntax questions. Link to comment Share on other sites More sharing options...
bernhard Posted 3 hours ago Share Posted 3 hours ago This <?php echo $map->render($page, 'YOUR MARKER FIELD'); ?> would be this {$map->render($page, 'YOUR MARKER FIELD')} Your error message means, that $map is NULL. That means $map is not available in your latte file for whatever reason. That means you are not struggling with latte syntax, you are struggling with PHP 😉 😛 You can easily debug this via TracyDebugger: {bd($map)} {bd($page)} To help you with your specific problem I'd need more info in where you are trying to use this markup... 1 Link to comment Share on other sites More sharing options...
MrSnoozles Posted 3 hours ago Share Posted 3 hours ago (edited) It looks like you need to make $map available in your Latte file first. Then, as Bernhad has said, you could write in your Latte file {$map->render($page, 'YOUR MARKER FIELD')} With https://processwire.com/modules/template-engine-latte/ you would write something like the following in your PHP template file (or ready.php): $view->set('map', $map); It might vary depending on which modules you use exactly in your project. Edited 3 hours ago by MrSnoozles Link to comment Share on other sites More sharing options...
bernhard Posted 3 hours ago Share Posted 3 hours ago 4 minutes ago, MrSnoozles said: $views->set('map', $map); RockFrontend / Latte doesn't provide this syntax as far as I know. What are you referring to? 8 minutes ago, sebibu said: https://processwire.com/modules/fieldtype-leaflet-map-marker/ Ah sorry, now I see $map should be a map marker object. The docs there state this: <?php $map = wire('modules')->get('MarkupLeafletMap'); ?> Which you could do in latte like this: {var $map = wire('modules')->get('MarkupLeafletMap')} Link to comment Share on other sites More sharing options...
MrSnoozles Posted 3 hours ago Share Posted 3 hours ago 1 minute ago, bernhard said: What are you referring to? Updated the post to be clear it's an example and varies depending on which modules are used. 1 Link to comment Share on other sites More sharing options...
Recommended Posts