Forums

need to format article text

ugly 06 Jan, 2010
I am using a chrono form to construct a dynamic article. The form returns content + div structure and this is deposited in my database -works fine.

$introtext = '<div id="articlecontainer"><div id="artheader">'."$intro".'</div><div id="leftcol"><div class="artimages">'."$holder1".'</div><div class="artimages">'."$holder2".'</div><div class="artimages">'."$holder3".'</div></div><div id="rightcol"><div id="rightcolcontent">'."$introtext" .'</div></div></div>';

//$introtext=nl2br($introtext);



I need introduce some line breaks so that the output breaks logically over lines and divs and looks like below. I have tried to introduce characters to get this but am struggling. Any advice much appreciated.

<div id="articlecontainer">
<div id="artheader">'."$intro".'</div>
<div id="leftcol">
<div class="artimages">'."$holder1".'</div>
<div class="artimages">'."$holder2".'</div>
<div class="artimages">'."$holder3".'</div></div><div id="rightcol"><div id="rightcolcontent">'."$introtext" .'</div>
</div>
</div>

GreyHead 06 Jan, 2010
Hi ugly,

And the problem is . . .?

Bob
ugly 06 Jan, 2010
For some reason my article template will not render the saved article unless it has line breaks. At the moment it's one continous string I need to insert breaks that break the code onto new lines.
GreyHead 06 Jan, 2010
Hi ugly,

What is being saved in the database record?

Bob
ugly 06 Jan, 2010
Hi Bob,
This string is being saved in the article field as one long undifferentiated string with no line breaks-


<div id="articlecontainer"><div id="artheader">'."$intro".'</div><div id="leftcol"><div class="artimages">'."$holder1".'</div><div class="artimages">'."$holder2".'</div><div class="artimages">'."$holder3".'</div></div><div id="rightcol"><div id="rightcolcontent">'."$introtext" .'</div></div></div>




I need it to saved as is above but with some line breaks so it appear as thus - the line breaks need to be saved in the mysql database otherwise for some unknown reason I have problems with the template rendering the article. If the above string appears as below all is fine -but how do I get chronos to write it to the database in this form

<div id="articlecontainer">
<div id="artheader">'."$intro".'</div>
<div id="leftcol">
<div class="artimages">'."$holder1".'</div>
etc etc et
GreyHead 06 Jan, 2010
Hi ugly,

OK - I see what you are saying now - but that 'long string' is perfectly valid html. I'm not sure why adding line-breaks would make any difference to the way it looks in the Joomla article :-(

I'll have to experiment later.

Bob
ugly 06 Jan, 2010
Exactly what I thought Bob it makes the world of diffrence why I don't know. Thank you for your imput
This topic is locked and no more replies can be posted.