Drupal Display Suite Code Field Issue: How to output Tokens, or PHP $entity inline -
i attempting 2 fields display inline. specifically, need locator, , body fields display inline.
my locator states location of post in plain text.
i.e. "duluth, mn - "
my body story.
i.e. "are strange things happening in house? lights turning off , on themselves? or hearing voices in basement?"
i'm attempting display them inline having hardest time.
i.e. "duluth, mn - strange things happening in house? lights turning off , on themselves? or hearing voices in basement?"
they need 2 separate fields use in geo locator.
i use display suite module, , web searches have found possible use custom code field option pull data token, or php $entity.
i can working fine both token, , php $entity, cannot figure out how them inline?
i.e result always:
"duluth, mn -
strange things happening in house? lights turning off , on themselves? or hearing voices in basement?"
i'm sure i'm missing easy, and/or overlooking something.
here code i've used:
works! tokens!
[node:field-locator] - [node:body]
works! php!
<?php print $entity->field_locator['und'][0]['value']; ?>
doesn't work!? php!
<?php print $entity->field_locator['und'][0]['value']; " - "; $entity->body['und'][0]['value']; ?>
works! php!
<?php print $entity->field_locator['und'][0]['value']; ?> <?php print " - "; ?> <?php print $entity->body['und'][0]['value']; ?>
if want concatenate 2 strings in php, have use "." operator. so, printing many variables on same line, have concatenate them:
<?php print $entity->field_locator['und'][0]['value'] ." - " . $entity->body['und'][0]['value']; ?>
i hope help!
Comments
Post a Comment