I am using the following in my node-blog.tpl.php:
<div class="blog-image" style="float:<?php print $node->field_image_float[0]['view'] ?>;padding:8px;margin:5px;"><?php print $node->node_images ?></div>
and giving users the chance to float the image to the left or right. And it's working fine on my English site but now want to give the same tools to my Italian site users. I could just use "left" and "right" and explain in the help text what each of them means, but I would prefer to use the Italian words sinistra/destra and then use some conditional php to transform that into left/right on the template. Is that a complicated thing to do?
Neil
Neil: esl-lounge.com wrote:
I am using the following in my node-blog.tpl.php:
<div class="blog-image" style="float:<?php print $node->field_image_float[0]['view'] ?>;padding:8px;margin:5px;"><?php print $node->node_images ?></div>
and giving users the chance to float the image to the left or right. And it's working fine on my English site but now want to give the same tools to my Italian site users. I could just use "left" and "right" and explain in the help text what each of them means, but I would prefer to use the Italian words sinistra/destra and then use some conditional php to transform that into left/right on the template. Is that a complicated
If I have understood you correctly, then try this:
<?php $side = 'sinestra' == $node->field_image_float[0]['view'] ? 'right' : 'left'; ?>
and then use this:
style="float:<?php print $side ?>
See here:
http://www.msbware.com/articles/php/unary_binary_and_ternary_operators.html
for more info.
Fred
Thanks for that. You got left/right mixed up so my final code is:
<?php $side = 'sinistra' == $node->field_image_float[0]['view'] ? 'left' : 'right'; ?>
<div class="blog-image" style="float:<?php print $side ?>;padding:8px;margin:5px;"><?php print $node->node_images ?></div>
thanks again
Neil
----- Original Message ----- From: "Fred Jones" fredthejonester@gmail.com To: support@drupal.org Sent: Tuesday, April 08, 2008 12:05 PM Subject: Re: [support] How to translate a value entered in CCK field into something else on the page
Neil: esl-lounge.com wrote:
I am using the following in my node-blog.tpl.php:
<div class="blog-image" style="float:<?php print $node->field_image_float[0]['view'] ?>;padding:8px;margin:5px;"><?php print $node->node_images ?></div>
and giving users the chance to float the image to the left or right. And it's working fine on my English site but now want to give the same tools to my Italian site users. I could just use "left" and "right" and explain in the help text what each of them means, but I would prefer to use the Italian words sinistra/destra and then use some conditional php to transform that into left/right on the template. Is that a complicated
If I have understood you correctly, then try this:
<?php $side = 'sinestra' == $node->field_image_float[0]['view'] ? 'right' : 'left'; ?>
and then use this:
style="float:<?php print $side ?>
See here:
http://www.msbware.com/articles/php/unary_binary_and_ternary_operators.html
for more info.
Fred
[ Drupal support list | http://lists.drupal.org/ ]