Template trouble
-
Hi Devs!
First, thanks for the plugin, it promises to do everything I need. I did have quite a bit of trouble getting it working though, so in case anyone else is pulling their hair out, this is what happened:
I did a fresh install and copied a custom infowindow template to my theme directory.
The infowindow was only printing out the variable names and not the values.
Much debugging followed (verifying that the JSON passed was correct, that the templating engine worked, that everything backbone.js and underscore.js worked fine on a simple test page without the plugin).
I narrowed the problem down to the template actually being included without the <%= %> necessary for it to be parsed by the scripts. (So for instance<%= name =>
was included asname
).
I fixed it by changing google-map.php with the following:public static function wp_print_footer_scripts() { $template = locate_template( 'stellar-places/info-window.html' ); if ( empty( $template ) ) { $template = dirname( STELLAR_PLACES_FILE ) . '/includes/templates/info-window.html'; } // Added this. $template_string = file_get_contents($template); echo '<script type="text/template" id="stellar-places-info-window-template">'; // Removed this. //include( $template ); //Added this. echo $template_string; echo '</script>'; }
No idea why “include” didn’t work, but there you go.
- The topic ‘Template trouble’ is closed to new replies.