-1

I am using in this way. Please correct me if i am wrong

I want the output as "(variable_value)"

<?php if isset(variable_get('variable_name'))?>{ (<?php print t(variable_get('variable_name'));?>)}:

1
  • Welcome to Drupal Answers! How to print the value returned from a function between parenthesis is a plain PHP question that involves concatenating strings: <?php print '(' . t(variable_get('variable_name')) . ')'; ?>.
    – apaderno
    Nov 28, 2015 at 10:01

2 Answers 2

0

Assuming your variable is a string:

<?php if(isset($variable)): ?>
  <div class="wrapper">
    <?php print $variable; ?>
  </div>
<?php endif; ?>

With variable_get() and brackets:

<?php if isset(variable_get('variable_name')): ?>
  "<?php print t(variable_get('variable_name')); ?>"
<?php endif; ?>
2
  • I want the value to be printed in brackets i.e (variable_value) Nov 5, 2015 at 8:20
  • Last edit with only brackets Nov 5, 2015 at 8:23
0
<?php if isset(variable_get('variable_name')): ?>
 <?php print t('('. variable_get('variable_name') . ')'); ?>
<?php endif; ?>

Not the answer you're looking for? Browse other questions tagged or ask your own question.