A few small changes are suggested for the template files:

  • To avoid unnecessary errors when E_ALL is set higher, instead of doing if ($var): it should be if (!empty($var)):
  • For template files it is cleaner to use
     if ():


     foreach ():

    instead of

     if () {


     foreach () {
  • Because all fields can be enabled / disabled at will via the field settings, all fields should be optional, inc $map_link.
Members fund testing for the Drupal project. Drupal Association Learn more


DamienMcKenna’s picture

Status: Active » Needs review
4.65 KB

Here's a patch that cleans up the tpl files a little bit.

DamienMcKenna’s picture

4.65 KB

Slight correction.

This patch sponsored by Bluespark Labs.

rooby’s picture

Status: Needs review » Fixed

Thanks for the patch.
Committed with a few minor additions:
* A couple of indenting and spacing changes.
* A slight change also to location_distance.tpl.php
* Change to use format_plural in locations.tpl.php
* Changed a couple of extra echos to prints so they are now all consistent.
* A fix for the following code in the patch from #2:

+++ location.tpl.php	28 Aug 2010 21:29:02 -0000
@@ -1,55 +1,52 @@
+  <?php if (!empty($city)): ?>
+    <span class="locality"><?php print $city; ?></span><?php if ($province): ?>,<?php endif; ?>
+    <?php if (!empty($province)): ?>
+      <span class="region"><?php print $province_print; ?></span>
+    <?php endif; ?>
+    <?php if (!empty($postal_code)): ?>
+      <span class="postal-code"><?php print $postal_code; ?></span>
+    <?php endif; ?>
+  <?php endif; ?>

Province and post code would not display if city was not present.


Powered by Dreditor.

rooby’s picture

Marked #785208: Fix indenting of template files as duplicate of this issue.

DamienMcKenna’s picture

Thanks Rooby.

rooby’s picture

No worries.

Also committed to DRUPAL-7--3.

Status: Fixed » Closed (fixed)

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