Newline Issues in Ticket Body

Jason Palmer's Avatar

Jason Palmer

23 May, 2009 01:53 AM


I have been struggling all afternoon trying to get newlines to show up properly in the body of a ticket submitted via the API. I have a simple form that people can fill out that submits a ticket to Lighthouse via the API. One of the form fields is a textarea, and newlines from that show up great...

However, when I try to add my own lines of text to the body it is ALWAYS written on a single line no matter if I use "\n" or "\r\n".

Any ideas about what I could do to fix this? I've tried everything...

  1. 1 Posted by Jason Palmer on 23 May, 2009 01:54 AM

    Jason Palmer's Avatar

    As a side note, I am using PHP and CURL to utilize the API.

    Thanks in advance.

  2. 2 Posted by Jason Palmer on 23 May, 2009 01:56 AM

    Jason Palmer's Avatar

    Here is the sample of code that is having the issue..

        //Pre-pend submittors information to the body
        $body_html_prepend = "Submission Details\r\n";
        $body_html_prepend .= "Name: " . $data['name'] . "\r\n";
        //$body_html_prepend .= "Email: " . $data['email'] . "\r\n";
        $body_html_prepend .= "Company: " . $data['company'] . "\r\n\r\n";
        $project_id = $data['product']; 
        $html_body = $body_html_prepend . $data['body'];
        $title = $data['subject'];
        $state = 'new';
        $notify_all = 1;
        $lighthouse_xml = "
            <?xml version=\"1.0\" encoding=\"UTF-8\"?>
              <project-id type=\"integer\">$project_id</project-id>
  3. 3 Posted by Rick on 23 May, 2009 08:48 PM

    Rick's Avatar

    We're using markdown, so you'll have to add two spaces to the end of lines to keep the linespace. Or, you can use the @@@ code sections:

    //Pre-pend submittors information to the body
    $body_html_prepend = "Submission Details  \r\n";
    $body_html_prepend .= "Name: " . $data['name'] . "  \r\n";
    //$body_html_prepend .= "Email: " . $data['email'] . "  \r\n";
    $body_html_prepend .= "Company: " . $data['company'] . "\r\n\r\n";


    //Pre-pend submittors information to the body
    $body_html_prepend = "@@@\r\nSubmission Details\r\n";
    $body_html_prepend .= "Name: " . $data['name'] . "\r\n";
    //$body_html_prepend .= "Email: " . $data['email'] . "\r\n";
    $body_html_prepend .= "Company: " . $data['company'] . "\r\n@@@\r\n\r\n";

    Also, don't bother setting body-html, that's automatically created by lighthouse.

  4. 4 Posted by Jason Palmer on 23 May, 2009 10:20 PM

    Jason Palmer's Avatar

    Thanks I'll give this a shot!

    On May 23, 2009, at 4:39 PM, "Lighthouse Support"[email blocked] > wrote:

  5. 5 Posted by Jason Palmer on 24 May, 2009 01:11 AM

    Jason Palmer's Avatar

    Thanks for the info.

    This solved the problem with the API, however I'm noticing that the notification emails that are sent out contain the characters that denote a code section. This really isn't a show-stopper though, but it'd be nice if those characters weren't included in the outgoing email. If we decide to use more formatting in the future that could become problematic.


Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac