Welcome Guest, Not a member yet? Register   Sign In
auto_typography class error?
#1

[eluser]epseix[/eluser]
Slightly confused as having read up on this class/library - it's exactly what I need to format large text pulled from my database - however, the line breaks do no generate the desired results when the text is pulled from a variable.

Code:
$variable = "This is a \n paragraph";
auto_typography($variable);

HTML source code:

Code:
<p>This is a \n paragraph</p>

Am I missing something?
#2

[eluser]jairoh_[/eluser]
use <br> instead. html does not read \n
#3

[eluser]ortwin.van.vessem[/eluser]
Ensure you have loaded the helper class in the autload.php or in the controller and use it like below in your controller.

Code:
$string = "Line 1 \nLine2";
$data['string'] = $this->typography->auto_typography($string);

$this->load->view('view', $data);

In the view you can use the variable $string.




Theme © iAndrew 2016 - Forum software by © MyBB