Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/197241-editor-adding-in-line-breaks-i-think/
Share on other sites

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.

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.