elivz / VzAddress-Craft

Address fieldtype for the Craft CMS
30 stars 13 forks source link

on _entry template, everything returns null #8

Closed lenchantin closed 8 years ago

lenchantin commented 8 years ago

I'm trying to return an address. I can't get any field to return without an error.

{{ entry.eventAddress.html }} returns the error "Impossible to access an attribute ("html") on a null variable" -- returns the same thing with "street" or "name" or anything else.

elivz commented 8 years ago

For some reason, the eventAddress field isn't getting passed into your template (thus, null). Are you certain that field is assigned to the entry you are viewing?

You could handle potentially non-existent address by wrapping the address tags with:

{% if entry.eventAddress is defined %}
  {{ entry.eventAddress.html }}
{% endif %}