Adding line breaks in language file text

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

By gkornbluth - November 17, 2018 - edited: November 18, 2018

Hi All,

I’m trying to add an additional “Tip” under the Add or Upload File(s) line of Upload fields.

I've found the entry for “Tip: hold <Ctrl> to select multiple files ==> Tip: hold <Ctrl> to select multiple files“ on line 222 of the lib/languages/en.php.

I’ve tried to insert a line break before the new text I'm adding by using a <br />, an \&lt; br \&gt;, an \r\n, and a \n, but discovered that the $tip variable on line 108 in lib/fieldtypes/upload.php uses htmlencode (in v 3.14) and so everything displays as those characters instead.

I can’t figure out how to insert a line break in the new “Tip” text without removing the htmlencode from line 108 (v 3.14), but I’m concerned that this approach creates a potential security breach, and possibly other issues (and besides, this code has been removed in V3.15).

Any ideas?

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

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