By storbaek on
I am using the following to print a location:
print theme ('location', $location); However, I need it to print 'No location entered' if not location is entered. Does anyone know how to do this with PHP?
I am using the following to print a location:
print theme ('location', $location); However, I need it to print 'No location entered' if not location is entered. Does anyone know how to do this with PHP?
Comments
not sure but try this
shakethetv.com - lyrics - music
small tweak
shakethetv's code is perfectly workable but can be shortened slightly...
Mark Sanders
Q Collective
Mark Sanders
Q Collective
Even shorter: use the ternary operator
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
ty i did not know this one
ty i did not knew this one
Works perfectly
Not sure what "ternary operator" is, but it works perfectly. Thanks!
Ternary operator
expr1 ? expr2 : expr2
means
if expr1 then expr 2 otherwise expr3
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
OT: I18N missing?
'No location entered' looks like a string that should be translated:
print $location ? theme('location', $location) : t('No location entered');--
~/.singatrue: file not found
subscribe
subscribe
Drupal samurai for hire, based in Buffalo, New York, USA.
15+ years Drupal, 20+ years web.
http://basicmagic.net
subscribe
link