Page 1 of 1
How to do lines in contact of the comments section [SOLVED]
Posted: Fri Jan 22, 2021 1:43 am
by zigi00x
How to make the text with the space in the comments section of the contacts??
Text without lines is displayed here, it ignores lines.
Code: Select all
<div class="col-sm-6">
{% if open %}
<strong>{{ text_open }}</strong><br />
{{ open }}<br />
<br />
{% endif %}
{% if comment %}
<strong>{{ text_comment }}</strong><br />
{{ comment }}
{% endif %}
</div>
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 2:01 am
by mikeinterserv
Try removing the slash as first thing
<br />
to
<br>
How are you EDITING this code - file direct or in shop settings
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 2:23 am
by zigi00x
It didn't help, the problem persists
Text added in store settings, code is template / information / information.twig
There is full code:
Code: Select all
{{ header }}
<div id="information-contact" class="container">
<ul class="breadcrumb">
{% for breadcrumb in breadcrumbs %}
<li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
{% endfor %}
</ul>
<div class="row">{{ column_left }}
{% if column_left and column_right %}
{% set class = 'col-sm-6' %}
{% elseif column_left or column_right %}
{% set class = 'col-sm-9' %}
{% else %}
{% set class = 'col-sm-12' %}
{% endif %}
<div id="content" class="{{ class }}">{{ content_top }}
<h1 class="page-title">{{ heading_title }}</h1>
<h3>{{ text_location }}</h3>
<div class="panel panel-default">
<div class="panel-body">
<div class="row contact-info">
<div class="left">
{% if image %}
<div class="address-detail"><img src="{{ image }}" alt="{{ store }}" title="{{ store }}" class="img-thumbnail" /></div>
{% endif %}
<div class="address-detail"><strong>{{store }}</strong>
<address>
{{ address }}
</address>
{% if geocode %}
<a href="https://maps.google.com/maps?q={{ geocode|url_encode }} &hl={{ geocode_hl }} &t=m&z=15" target="_blank" class="btn btn-info"><i class="fa fa-map-marker"></i> {{ button_map }} </a>
{% endif %}
</div>
<div class="telephone">
<strong>{{ text_telephone }} </strong>
<address>{{ telephone }} </address>
</div>
<div class="fax">
{% if fax %}
<strong>{{ text_fax }} </strong>
<address>{{ fax }} </address>
{% endif %}
</div>
</div>
<div class="right">
<div class="map">
{#
$geo=explode(',',$geocode);
print_r($geo);
echo count($geo);
if(count($geo)==2){
echo "yes";
}
else{
echo "no";
}
#}
</div>
</div>
<div class="col-sm-6">
{% if open %}
<strong>{{ text_open }}</strong><br />
{{ open }}<br />
<br />
{% endif %}
{% if comment %}
<strong>{{ text_comment }}</strong><br />
{{ comment }}
{% endif %}
</div>
</div>
</div>
</div>
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 2:28 am
by mikeinterserv
Did you clear your cache from dashboard top right corner
Refresh your browser if it Chrome on the page press CTRL+SHIFT+R at the same time, that will give you a hard refresh.
What you have should work, the trailing slash is not really needed and some editors don't like it. or remove it
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 2:34 am
by zigi00x
Yes, I know, unfortunately it does not work, the problem is that when I enter the text in the settings of the store in the comment section, the text appears without spaces and is purely written in a row, I need to keep the lines between the text with a spaces.
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 2:46 am
by mikeinterserv
So if you enter data in comments store settings using return produces No line breaks.
It cannot be edited in the twig because it is just one set of text comments that is called there.
I see your problem more clearly now, I will look for the best way round it.
I am sure this has probably been covered before - did you do a search
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 2:55 am
by mikeinterserv
Well line breaks work fine in the opening times field
If you press return at the end of the line it gives you a new line in the display as expected.
In the comment field it DOES NOT DO THIS pressing return yields NO line break as you say.
I will look further into it.
Maybe someone with more expert opencart knowledge can add some information
Whether that's a bug or by design I do not know
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 3:13 am
by sw!tch
If you are trying to render html in the settings theme comment section, then it has to be decoded from the controller first.
If you are using text only and want new lines then you can do nl2br
Provide a link to your site and OC version if you want further help.
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 3:28 am
by zigi00x
Thank you very much! It works!
sw!tch wrote: ↑Fri Jan 22, 2021 3:13 am
If you are trying to render html in the settings theme comment section, then it has to be decoded from the controller first.
If you are using text only and want new lines then you can do nl2br
Provide a link to your site and OC version if you want further help.
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 3:29 am
by OSWorX
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 3:31 am
by mikeinterserv
sw!tch wrote: ↑Fri Jan 22, 2021 3:13 am
If you are trying to render html in the settings theme comment section, then it has to be decoded from the controller first.
If you are using text only and want new lines then you can do nl2br
Provide a link to your site and OC version if you want further help.
The OP just needs it to work EXACTLY like the OPENING TIMES field.
I would expect the input to accept line breaks so would other s I imagine
I think your suggetion is not going to work for the OP he has 3-4 lines he wants
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 3:32 am
by mikeinterserv
No that's NOT really related to this = you cannot get to the comment to SPLIT it in the twig
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 3:38 am
by sw!tch
mikeinterserv wrote: ↑Fri Jan 22, 2021 3:31 am
sw!tch wrote: ↑Fri Jan 22, 2021 3:13 am
If you are trying to render html in the settings theme comment section, then it has to be decoded from the controller first.
If you are using text only and want new lines then you can do nl2br
Provide a link to your site and OC version if you want further help.
The OP just needs it to work EXACTLY like the OPENING TIMES field.
I would expect the input to accept line breaks so would other s I imagine
I think your suggetion is not going to work for the OP he has 3-4 lines he wants
Yup and that's the solution I gave. OP confirmed.
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 3:41 am
by mikeinterserv
Sorry switch missed his post
good job :-)
Re: How to do lines in contact of the comments section
Posted: Fri Jan 22, 2021 7:46 pm
by paulfeakins
mikeinterserv wrote: ↑Fri Jan 22, 2021 3:41 am
Sorry switch missed his post
good job :-)
Please add [SOLVED] to the start of the post title.