Adding line breaks in language file text

4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 20, 2018   (RSS)

By daniel - November 19, 2018

Hi Jerry,

I would recommend against removing the htmlencode() function; it's not a particularly big security risk, but that's not a change likely to make it into the core code so you'd have to worry about redoing it any time you upgrade CMSB.

Instead, it might be more appropriate to add any additional text to the Description of the upload field. The description's output was accidentally dropped from the upload field in 3.14, but you can re-add it relatively easily by updating /cmsb/lib/menus/default/edit_functions.php (at line 886, just after the "Tip: hold..." text) to look like this:

...

  if (@$fieldSchema['maxUploads'] != 1) {
    echo '<div class="text-center">' . htmlencode( t("Tip: hold $key to select multiple files") ) . '</div>';
  }
?>
<br/>
<?php if ($description) { print "<p class=\"help-block\">$description</p>\n"; } ?>

...

This change will also be present in future releases of CMSB.

Let me know any questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

Thanks For looking at this, Daniel, (but don't you ever go home?)

I found the code (actually on line 883 in V3.15)

if (@$fieldSchema['maxUploads'] != 1) {
    echo '<div class="text-center">' . htmlencode( t("Tip: hold $key to select multiple files") ) . '</div>';
  }
?>

and will add

<br/>
<?php if ($description) { print "<p class=\"help-block\">$description</p>\n"; } ?>

I'm still not really clear how I'd add a second or third line with a line break so that the final output is, for example:

Tip: hold $key to select multiple files
Some other text on new line
Some additional text on new line

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By daniel - November 20, 2018

Hi Jerry,

With that new code in place, you should be able to add text to the Description field when editing the upload field. This text won't display directly under the Tip text (it'll be left aligned and placed lower), but it should be possible to use HTML formatting to get your desired results. For example, the following should put two lines directly under the Tip:

<span style="display: block; text-align: center; margin-top: -22px;">Other text<br />3rd line</span>

Hope that helps!

Thanks,

Daniel
Technical Lead
interactivetools.com