theming drupal location module

Joined: 01/09/2009

Hello,

I've been searching for a way to theme the output of the location module. I've been Google'ing for a couple of days and can't seem to find what i'm looking for. I can see where the default theming file is for the module, but I'm assuming that it would be better to not change that, but rather to change it specifically for my theme. I hope that I have supplied enough information.

Thanks

Joined: 10/18/2008
Depends on what you want to

Depends on what you want to do. You can do a lot in css.

For example:

// Display fields & form inline and make forms line up
#edit-field-location-0-street-wrapper label,
#edit-field-location-0-additional-wrapper label,
#edit-field-location-0-city-wrapper label,
#edit-field-location-0-province-wrapper label,
#edit-field-location-0-postal-code-wrapper label,
#edit-field-location-0-country-wrapper label
{
  float: left;
  text-align: left;
  width: 150px;
  padding-right: 5px;
}

// Make the form elements all the same width
input#edit-field-location-0-street.form-text,
input#edit-field-location-0-additional.form-text,
input#edit-field-location-0-city.form-text,
input#edit-field-location-0-province.form-text,
input#edit-field-location-0-postal-code.form-text,
{
  width: 250px;
  margin-bottom: 1px;
}

My biggest beef is when forms don't line up. So that's what I personally changed. You can also use "display:none" to hide elements you might need but don't want shown (like the lat/lon fields).

/ * Begin Signature */
It's a strange thing about determined seekers-after-wisdom that, no matter where they happen to be, they'll always seek that wisdom which is a long way off. Wisdom is one of the few things that looks bigger the further away it is.

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
the theme system

Do you know how the theme system works with overrides and theme specific changes?

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com

Joined: 01/09/2009
I'm sorry

Actually, not completely. I am still somewhat new to this stuff, but I'm trying to learn as much as I can as fast as I can and I really appreciate all the help I get from the G&G community.

I'm actually trying to override the default HTML output by the theme, so CSS isn't going to help me too much for this particular issue.

thanks guys

Joined: 10/18/2008
What exactly are you wanting

What exactly are you wanting to do?

/ * Begin Signature */
It's a strange thing about determined seekers-after-wisdom that, no matter where they happen to be, they'll always seek that wisdom which is a long way off. Wisdom is one of the few things that looks bigger the further away it is.

Joined: 01/09/2009
what i'm trying to change

Well, right now when i view my location module output it shows the "Name" field, and then a "See Map" field, but no address or other information. There are some times when i'd like to show the address and the map link and other times I only want one or the other but not both. I would love to learn how to access each of the fields in the array individually.

Joined: 09/09/2008
This might help

The Content Template module (Contemplate) is useful whether you use content templates, or not, to easily see what variables are available for a node type.

I've never seen a "See Map" field. What version of Drupal are you using?

Curt

Joined: 10/18/2008
You can use the output of the

You can use the output of the node to do your themeing. Are you using the cck location or location location?

For example if a node-nameofthingyyouwanttotheme.tpl.php file,

  print $node->location[0]['street'];
  print $node->location[0]['city']
  print $node->location[0]['province'];
  print $node->location[0]['country'];

Etcetera

You can use

  print "<pre>";
  print_r($node);
  print "</pre>";

/* or if you have devel installed */

  dpr($node);

to see everything in the node and just print out what you want.

/ * Begin Signature */
It's a strange thing about determined seekers-after-wisdom that, no matter where they happen to be, they'll always seek that wisdom which is a long way off. Wisdom is one of the few things that looks bigger the further away it is.

Joined: 01/09/2009
I'm actually using CCK

I'm actually using CCK location & location location, but i'm pretty sure the one I need to edit is the CCK location module. Also, the only thing i can access in the location array is ['view'].

G&G Podcast Host
Matt Farina's picture
Joined: 06/01/2006
Theme Overrides

I would take a quick read at the theme override system. This link will explain how you can override and change anything in the output... http://drupal.org/node/341628

Matt Farina
Geeks and God Former Co-Host
www.mattfarina.com