maxelct Posted April 1, 2010 Share Posted April 1, 2010 I am using joomla and editing one of the components - namely jevents. I am having a problem, that I think is probably a basic php type problem. In jevents there is a $cellString is used to print out some text into a tool tip. There is a field within the backend whose value I can pick up from the database like this: $this->location =nl2br($this->event->location()); To add in some extra detail to that tooltip so have added the second line below. $cellString = $publish_inform_overlay; $cellString. =$this->location; Now this works fine - sometimes. If I use the fck edito to enter the text and ENSURE THAT ITS ALL ON ONE LINE like this <p><strong>Location</strong>: Oxo tower</p><p>London</p><p>Admission:free</p> then everything works fine. However, the editor has a habit of spacing things out onto new lines when you save the work - like this: <p><strong>Location</strong>: Oxo tower</p> <p>London</p> <p>Admission:free</p> and now the code throws up errors. So, it looks like fck adding in line breaks (I think - dunno) is causing things to go wrong. Does anyone have any ideas of what I should do to stop this? tthanks Edward Quote Link to comment https://forums.phpfreaks.com/topic/197241-editor-adding-in-line-breaks-i-think/ Share on other sites More sharing options...
TeddyKiller Posted April 1, 2010 Share Posted April 1, 2010 What errors are actually given? It shouldn't give any really... but you could always just remove the <p> tags and add in <br /> Quote Link to comment https://forums.phpfreaks.com/topic/197241-editor-adding-in-line-breaks-i-think/#findComment-1035333 Share on other sites More sharing options...
premiso Posted April 1, 2010 Share Posted April 1, 2010 The nl2br is going to add line breaks whereever there is a \n. To remove this, simply take out the nl2br out of this line: $this->location =nl2br($this->event->location()); If you do that, just remember to always do html for the location, cause just doing plain text with line breaks will put it all on one line and break it out. Quote Link to comment https://forums.phpfreaks.com/topic/197241-editor-adding-in-line-breaks-i-think/#findComment-1035336 Share on other sites More sharing options...
maxelct Posted April 1, 2010 Author Share Posted April 1, 2010 Thanks for the replies - have removed the nl2br and still get same problem The error that comes up is Error: unterminated string literal Source File: http://127.0.0.1/index.php?option=com_jevents&view=month&task=month.calendar&Itemid=669 Line: 1, Column: 15 Source Code: return overlib('<div><br /> and like I said is only there when the editor puts things onto separate lines. Quote Link to comment https://forums.phpfreaks.com/topic/197241-editor-adding-in-line-breaks-i-think/#findComment-1035343 Share on other sites More sharing options...
premiso Posted April 1, 2010 Share Posted April 1, 2010 The error you just showed is a Javascript error, and in your original post you did not show any javascript that I can tell. Since this is Joomla you are using, you may do better to post the entire issue, with that JS error on their forums, as they are tailored to that software. As for us solving that error, it is very unlikely unless someone install's the exact joomla version you are using and tries. As for me, I do not feel like diving into Joomla to try and find the issue, sorry. Quote Link to comment https://forums.phpfreaks.com/topic/197241-editor-adding-in-line-breaks-i-think/#findComment-1035345 Share on other sites More sharing options...
maxelct Posted April 1, 2010 Author Share Posted April 1, 2010 point taken. Should have posted on JS forum sorry Quote Link to comment https://forums.phpfreaks.com/topic/197241-editor-adding-in-line-breaks-i-think/#findComment-1035354 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.