so when i add a location all works well but when it shows in the node it's kind of ugly - specifically: i'd like to change the color of the text, and most importantly insert a line break when there is more than one location (right now they squish up with no line break)

i can see that there is some kind of styling applied because of the use of italics for 'location name' - but where is this, and how might it be altered?

Comments

tpaschke’s picture

StatusFileSize
new50.58 KB

Similarly to above post, I would like to change the styling of the location output.

Using GMap and Location modules (most current version) on Drupal 6.6. Was able to determine that the "vcard" class is a well-used php code. I tracked down the php that generates the "Location" export (location.tpl.php):

<div class="location vcard"><div class="adr">
<?php echo $name; ?>
<?php if ($street) {?>
<div class="street-address"><?php
  echo $street;
  if ($additional) {
    echo ' '. $additional;
  }
?></div>
<?php }?>
<?php
  if ($city || $province || $postal_code) {
    $city_province_postal = array();

    if ($city) {
      $city_province_postal[] = '<span class="locality">'. $city .'</span>';
    }
    if ($province) {
      $city_province_postal[] = '<span class="region">'. $province .'</span>';
    }
    if ($postal_code) {
      $city_province_postal[] = '<span class="postal-code">'. $postal_code .'</span>';
    }

    echo implode(', ', $city_province_postal);
  }
?>
<?php if ($country_name) { ?>
<div class="country-name"><?php echo $country_name; ?></div>
<?php } ?>
<?php
  // "Geo" microformat, see http://microformats.org/wiki/geo
  if ($latitude && $longitude) {
    // Assume that 0, 0 is invalid.
    if ($latitude != 0 || $longitude != 0) {
?>
<span class="geo"><abbr class="latitude" title="<?php echo $latitude; ?>"><?php echo $latitude_dms; ?></abbr>, <abbr class="longitude" title="<?php echo $longitude; ?>"><?php echo $longitude_dms; ?></abbr></span>
<?php
    }
  }
?>
</div></div>

So, from what I can deduce (admittedly ill-informed with script aspects of Drupal - relatively new user, but I like to dig in), depending on how you are using GMap (and additional GMap add-ons) and Location modules, jQuery generates the text from the location input and passes it through location.tpl.php. I also CANNOT find any CSS to control the styling of this output (I have checked all CSS references on a given page - no luck).

I, as well, would like to add a simple   between multiple location entries at minimum. This must be an easy fix, but I don't know how to do it.

Any more seasoned users have some helpful hints? I have attached a screenshot of my situation...and I think it's similar to the above post. The page in question is: http://mwrm2009.org/iowa-city if that helps. Thanks for your patience!

summit’s picture

Subscribing, wanting to theme location also.
greetings,
Martijn

yesct’s picture

Months ago, I used contemplate to get the location data to display the way I wanted...

zirafa’s picture

I believe this issue is also related...(can't form_alter the forms)

SeanA’s picture

Component: Documentation » Code
StatusFileSize
new2.4 KB

OK, here's what I'm doing to theme the location. The patch

  • removes the 'placeholder' theming in location.module
  • puts some css classes in location.tpl.php
  • in location.tpl.php: omits the comma between the city and postal code
  • in location.tpl.php: outputs the phone and fax fields (if any) just below the map links

Applies for 6.x and 5.x. Addressing the original question, if you want to put a break between multiple locations, it looks like that would go in locations.tpl.php (not the same as above file, note the 's'). Something like this:

<?php if (count($locations)) {?>
<h3><?php echo count($locations) > 1 ? t('Locations') : t('Location');?></h3>
<?php
  foreach ($locations as $location) {
    echo $location . "<br>"; // kind of ugly i'm sure there's a better way =//
  }
}
SeanA’s picture

StatusFileSize
new267 bytes

Here are the styles to copy into your theme's style.css.

SeanA’s picture

Title: styling the "location" as it appears in a node - how? what's the field item? » Theming the "location" as it appears in a node
Category: support » task
Status: Active » Needs review

Any feedback on the patch in #5? It's meant to fix a few issues related to theming the location output. Would it be better to create separate issues and deal with them individually?

yesct’s picture

Issue tags: +Location theming

tagging

dyke it’s picture

this worked really well for me. thank you!!!

yesct’s picture

Yeah, I'm not sure about lumping all the fixes into one...
does this patch fix problems, or does it just format stuff the way you want it?
Does it break anything... like if people dont put in special css?

there is a good chance of getting some things committed, if a patch can be re-rolled to match the new 6.x-dev version (http://drupal.org/project/location)

SeanA’s picture

StatusFileSize
new442 bytes

At this point most of these issues have already been taken care of, or are being dealt with elsewhere. The last thing to do is remove the "placeholder" theming on the location name, which wraps the text in <em> tags (see http://api.drupal.org/api/function/theme_placeholder/6). I don't think there's any need to keep this around any more, since there's now a CSS class applied to the location name in location.tpl.php.

ankur’s picture

Status: Needs review » Fixed

committed #11 to HEAD, DRUPAL-6--3

Status: Fixed » Closed (fixed)
Issue tags: -Location theming

Automatically closed -- issue fixed for 2 weeks with no activity.