Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Wordwrap do not work

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
bougli
Smarty Rookie


Joined: 04 Oct 2018
Posts: 6

PostPosted: Thu Oct 04, 2018 7:10 am    Post subject: Wordwrap do not work Reply with quote

Hello
i need to cut sentence with some "BR".
With this simple code, it does nothing (the sentence remains the same)

Code:
{assign var=ligne1 value="rghuir gerg egerg eaz azefziuher zreg ergh ieazd aazdad"}
<b>{$ligne1|wordwrap:20:"<br />\n":true}</b>


In theory i should have one BR every 20 chars, right ?
i use 3.1.32 smarty version.

thanks !
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1545

PostPosted: Thu Oct 04, 2018 9:15 am    Post subject: Reply with quote

Working as expected.
Code:
<?php

require_once 'smarty-config.php';

$smarty->display(__FILE__);

__halt_compiler();
?><b>{"rghuir gerg egerg eaz azefziuher zreg ergh ieazd aazdad"|wordwrap:20:"<br />\n":true}</b>


Code:
<b>rghuir gerg egerg<br />
eaz azefziuher zreg<br />
ergh ieazd aazdad</b>
Back to top
View user's profile Send private message
bougli
Smarty Rookie


Joined: 04 Oct 2018
Posts: 6

PostPosted: Thu Oct 04, 2018 9:20 am    Post subject: Reply with quote

ho ! i tested your syntax and it works when directly putting sentence between brace, but not working when coming from the assign function like in my exemple.
Could you confirm please ?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1545

PostPosted: Thu Oct 04, 2018 12:06 pm    Post subject: Reply with quote

It works either way.
Code:
<b>{$s="rghuir gerg egerg eaz azefziuher zreg ergh ieazd aazdad"}
{$s|wordwrap:20:"<br />\n":true}</b>


Code:
<b>{assign var="s" value="rghuir gerg egerg eaz azefziuher zreg ergh ieazd aazdad"}
{$s|wordwrap:20:"<br />\n":true}</b>


All results are identical.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1545

PostPosted: Thu Oct 04, 2018 1:11 pm    Post subject: Reply with quote

https://github.com/AnrDaemon/test-001/tree/forum-27444
Back to top
View user's profile Send private message
bougli
Smarty Rookie


Joined: 04 Oct 2018
Posts: 6

PostPosted: Thu Oct 04, 2018 3:56 pm    Post subject: Reply with quote

ok i found what's wrong : i had an accent in the real sentence.
it was "".
If you add a such character, the function does not work anymore....
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1545

PostPosted: Thu Oct 04, 2018 5:46 pm    Post subject: Reply with quote

Can you please make a pull request against my repo?
Back to top
View user's profile Send private message
bougli
Smarty Rookie


Joined: 04 Oct 2018
Posts: 6

PostPosted: Fri Oct 05, 2018 6:50 am    Post subject: Reply with quote

can do nothing in pull request interface, i created an issue :
https://github.com/smarty-php/smarty/issues/495

thanks
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1545

PostPosted: Fri Oct 05, 2018 10:25 pm    Post subject: Reply with quote

bougli wrote:
can do nothing in pull request interface


1. Go to https://github.com/AnrDaemon/test-001/tree/forum-27444
2. Click "Fork".
3. Clone now your repository locally.
4. Checkout branch forum-27444
5. Make any changes to demonstrate your issue.
6. Commit and push your changes.
7. Make a pull request from your repo against that same branch forum-27444
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP