Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
152
rated 0 times [  153] [ 1]  / answers: 1 / hits: 58448  / 7 Years ago, mon, july 10, 2017, 12:00:00

I have the text on my website appear from a .json file, and I want to have the line appear as:



Phone: 123-456-7890



Local: 012-35-6789



Instead I am getting:



Phone: 123-456-7890
Local: 012-35-6789



My code:



footer{
call_us: Phone: {phone_number} n Local: 012-345-6789
}


Is there something besides n I should be using?



Edit:



I am calling the JSON text to be displayed using the following code. I believe this is using Handlebars



{{#if settings.phone_number}}
<strong>{{lang 'footer.call_us' phone_number=settings.phone_number}}</strong>
{{/if}}


Full Code:



<article class=footer-info-col footer-info-col--small data-section-type=storeInfo>
<h5 class=footer-info-heading>{{lang 'footer.info'}}</h5>
<address>{{nl2br settings.address}}</address>
<script> var footer={
call_us: Phone: {phone_number} n Local: 012-345-6789
}
for (var key in footer) {
if (footer.hasOwnProperty(key)) {
console.log(footer[key]);
}
}</script>
<!--{{#if settings.phone_number}}
<strong>{{lang 'footer.call_us' phone_number=settings.phone_number}}</strong>-->
{{/if}}
</article>

More From » html

 Answers
4

I solved this issue by breaking the JSON line into two separate lines, and in the HTML file adding in the second call with a <br> in between the two. I would still love to know if there is a simple command that would do this in JSON, like <br> or n but neither of those work for me.



JSON:



    footer: {
call_us: Phone: {phone_number},
localc: Local: 012-345-6789
}


HTML:



{{#if settings.phone_number}}
<strong>{{lang 'footer.call_us' phone_number=settings.phone_number}}</strong>
<br><strong>{{lang 'footer.localc'}}</strong>
{{/if}}

[#57136] Saturday, July 8, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yosefleod

Total Points: 113
Total Questions: 100
Total Answers: 115

Location: Egypt
Member since Tue, May 3, 2022
2 Years ago
;