A few small changes are suggested for the template files:

  • To avoid unnecessary errors when E_ALL is set higher, instead of doing
    <?php
     
    if ($var):
    ?>

    it should be

    <?php
     
    if (!empty($var)):
    ?>
  • For template files it is cleaner to use
    <?php
     
    if ():
    endif;
    ?>

    and

    <?php
     
    foreach ():
    endforeach;
    ?>

    instead of

    <?php
     
    if () {
    }
    ?>

    and

    <?php
     
    foreach () {
    }
    ?>
  • Because all fields can be enabled / disabled at will via the field settings, all fields should be optional, inc $map_link.

Comments

DamienMcKenna’s picture

Status:Active» Needs review
StatusFileSize
new4.65 KB

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

DamienMcKenna’s picture

StatusFileSize
new4.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.

http://drupal.org/cvs?commit=476314
http://drupal.org/cvs?commit=476310
http://drupal.org/cvs?commit=476312

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.
http://drupal.org/cvs?commit=478412

Status:Fixed» Closed (fixed)

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