Welcome Guest, Not a member yet? Register   Sign In
Input and linebreaks 2
#1

[eluser]cereal[/eluser]
Ok. If I use auto_typhography() each linebreak is converted into <br /> so for each paragraph I have something similar to this:

Code:
<p>Sitting on a cornflake waiting for the van to come<br />
Corporation teeshirt, stupid bloody Tuesday<br />
Man you been a naughty boy. You let your face grow long<br />
I am the eggman, they are the eggmen<br />
I am the walrus, goo goo goo joob</p>

The problem starts when I need to increase font size in the page (with js for example), each <br /> literally breaks the lines. What can I do to resolve this problem?
I've tried a solution but this doesn't make me really happy. In the parent::Controller I start a $_SESSION with value 'nobr':

Code:
$_SESSION['bbr'] = 'nobr';

And then I've modified the typography_helper.php file. In the really end of this file I've changed this:

Code:
$str = str_replace("\n\n", "</p>\n\n<p>", $str);
$str = preg_replace("/([^\n])(\n)([^\n])/", "\\1<br />\\2\\3", $str);

to this:
Code:
$str = str_replace("\n\n", "</p>\n\n<p>", $str);        
$str = ($_SESSION['bbr'] == 'nobr') ? $str : preg_replace("/([^\n])(\n)([^\n])/", "\\1<br />\\2\\3", $str);

So, if I want linebreaks I just change nobr to another value. Otherwise I set 'nobr'. Are there any cleaner solutions?

Sorry for my bad English.
Cheers, Joe
#2

[eluser]cereal[/eluser]
err.. never mind the problem was a problem of mine, not relating with CI, excuse me..
note: delete this thread if you want




Theme © iAndrew 2016 - Forum software by © MyBB