I would like to customise the info windows produced by the GMap module.
I installed the GMap Views module and created a view (having to include the lat/long fields).
I then tried to use the Views Theme Wizard to cusomise the output, including getting rid of the lat/long fields, but the changes I make aren't showing. The info windows still look like the basic views-created version, not my custom .tpl.php version.
I haven't tried hiding the fields using basic CSS (display: none), but will resort to that if I can't do it any other way...
Any ideas why the template wizard doesn't work?
Comments
Comment #1
Anonymous (not verified) commentedStill looking for a way to theme the output of the GMap pop-up windows.
Any advice would be much appreciated!
Comment #2
tom_o_t commentedInstructions on theming the gmap infowindow are at http://drupal.org/node/137776#comment-544103
In template.php add:
Create a new file in your theme called gmap_views_maker_label.tpl.php - it should include:
You can change this second chunk of code to whatever you want to theme the pop-up window - you have access to all the fields that you chose in your view.
Comment #3
Anonymous (not verified) commentedThanks, I'll give that a try.
That's a very obscure place to put theming instructions though...
Comment #4
Anonymous (not verified) commentedI tried the code you provided, but only got the latitude (or longitude).
How do I get my other fields?
Here's an example of one of my Devel outputs:
It only seems to list the names of the fields, not the values themselves...
Comment #5
tom_o_t commentedWhat fields are set for your view? You have to have both latitude & longitude fields, as well as any other fields you want to use in the themed infowindow.
Comment #6
Anonymous (not verified) commentedYeah, got that: fields I have are Name, Image, Price, Latitude & Longitude.
Comment #7
Anonymous (not verified) commentedStill looking for an answer to this...
Comment #8
tom_o_t commentedCan you provide a link to the view you're working on?
Did you delete the code you added with the theming wizard?
Comment #9
Anonymous (not verified) commentedHi Tom,
Here's test map I created to show you what's happening: http://restorwreck.com/map-test
I've re-added the theming wizard code (had gotten rid of it before).
I also commented out the code you posted previously as it was affecting both the test map and the main map. As I said above, it was only showing the one latitude (or longitude) value...
If you know of a way I can add your code to the test map and not the main one (http://restorwreck.com/map), let me know and I'll do that.
Comment #10
tom_o_t commentedI don't think I'm able to help you with this. The only way I know of to theme a gmap view is with the code I provided. Views theming doesn't work for a gmap view.
In function phptemplate_gmap_views_marker_label($view, $fields, $entry) you could try doing some checks on $view and passing it to different templates depending on which view you were passing. Then in gmap_views_maker_label.tpl.php try outputting all the data in $view, $fields and $entry using print_r() and you should see all the data that is included from the 'fields' you chose in the view.
Comment #11
Anonymous (not verified) commentedI'd be happy using this, however it only seems to be printing out the one value. Am I doing something wrong?
The only reason I needed two differently themed gmap views was to keep one working (the proper one) and one to show you (a temporary one that I'll delete once I get this sorted).
Once I get the theming working I won't need the two views.
Comment #12
whitewater77 commentedHi all,
how can this be applied to the Drupal6 theming concept?
I've tried out several ways to override the template shown in the GMAP info window screen, but it
always shows up with the very basic template generated by location.tpl.php...
Kind regards,
JP
Comment #13
whitewater77 commentedthis seems to be a problem only with the views module (+Location). On the node locations page the
gmap_location_infowindow_node.tpl.php is used as expected. But when I am using the Views Module with GMAP,
only the default location.tpl.php file is used. Is there any way to override this?
Comment #14
ryanoff commentedcould you please give an example of how to print out one line with a single variable in it? In your code you use the foreach loop to print all variables, but I do not understand how to simply print out a specific variable.
Comment #15
bartezz commentedAre we talking D5 or D6 in this thread???
Post Version = 6.x-1.0-rc2 but solutions given are D5??
Can't find a way to theme GMap with views either as phptemplate_gmap_views_marker_label is non existent in D6!!
Any help is much appreciated!
Comment #16
Anonymous (not verified) commentedPosts up to #11 were for Drupal 5.
Theming GMaps in Drupal 6 with Views 2 is just the same as any other type of view: override the template files that Views 2 lists.
As the majority of this issue is for Drupal 5, I'm marking it as so; and due to the age of the information here, I'm closing it. Questions about theming in Drupal 6 with Views 2 should be posted to a new issue to save confusion.