Post by zigi00x » Fri Jan 22, 2021 1:43 am

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>

Attachments

Výstřižek.PNG

Výstřižek.PNG (60.14 KiB) Viewed 360 times

Last edited by zigi00x on Sat Jan 23, 2021 4:49 am, edited 1 time in total.

New member

Posts

Joined
Wed Aug 15, 2018 1:20 am

Post by mikeinterserv » Fri Jan 22, 2021 2:01 am

Try removing the slash as first thing
<br />
to
<br>

How are you EDITING this code - file direct or in shop settings

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by zigi00x » Fri Jan 22, 2021 2:23 am

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>

New member

Posts

Joined
Wed Aug 15, 2018 1:20 am

Post by mikeinterserv » Fri Jan 22, 2021 2:28 am

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

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by zigi00x » Fri Jan 22, 2021 2:34 am

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.

New member

Posts

Joined
Wed Aug 15, 2018 1:20 am

Post by mikeinterserv » Fri Jan 22, 2021 2:46 am

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

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by mikeinterserv » Fri Jan 22, 2021 2:55 am

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

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by sw!tch » 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

Code: Select all

{{ comment | nl2br }}
Provide a link to your site and OC version if you want further help.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm
Location - USA

Post by zigi00x » Fri Jan 22, 2021 3:28 am

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

Code: Select all

{{ comment | nl2br }}
Provide a link to your site and OC version if you want further help.

New member

Posts

Joined
Wed Aug 15, 2018 1:20 am

Post by OSWorX » Fri Jan 22, 2021 3:29 am

Seems to be related to this: viewtopic.php?f=202&t=221436#p810231

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Guru Member

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by mikeinterserv » 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

Code: Select all

{{ comment | 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

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by mikeinterserv » Fri Jan 22, 2021 3:32 am

OSWorX wrote:
Fri Jan 22, 2021 3:29 am
Seems to be related to this: viewtopic.php?f=202&t=221436#p810231
No that's NOT really related to this = you cannot get to the comment to SPLIT it in the twig
Last edited by mikeinterserv on Fri Jan 22, 2021 3:39 am, edited 1 time in total.

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by sw!tch » Fri Jan 22, 2021 3:38 am

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

Code: Select all

{{ comment | 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.

Full Stack Web Developer :: Send a PM for Custom Work.
Backup and learn how to recover before you make any changes!


Active Member

Posts

Joined
Sat Apr 28, 2012 2:32 pm
Location - USA

Post by mikeinterserv » Fri Jan 22, 2021 3:41 am

Sorry switch missed his post
good job :-)

Active Member

Posts

Joined
Thu May 28, 2020 6:55 am
Location - Wales

Post by paulfeakins » Fri Jan 22, 2021 7:46 pm

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.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Guru Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom
Who is online

Users browsing this forum: No registered users and 17 guests